printf("ho_tari\n");

입출력 함수, 화씨온도 변환기 본문

Python

입출력 함수, 화씨온도 변환기

호타리 2023. 10. 12. 14:46

<input.py>

print("Enter your name:")
somebody = input()
print("Hi", somebody, "How are you today?")

<compile 결과>

 

<print.py>

temperature = float(input("온도를 입력하세요: "))
print(temperature)

<compile 결과>

 

<fahrenheit.py>

print("본 프로그램은 섭씨온도를 화씨온도로 변환하는 프로그램입니다.")
print("변환하고 싶은 섭씨온도를 입력하세요.")

celsius = input()
fahrenheit = (float(celsius) * 1.8) + 32

print("섭씨온도:", celsius)
print("화씨온도:", fahrenheit)

<compile 결과>

'Python' 카테고리의 다른 글

문자열  (0) 2023.10.16
함수  (0) 2023.10.16
반복문  (0) 2023.10.12
조건문  (0) 2023.10.12
리스트  (0) 2023.10.12