-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.py
More file actions
29 lines (20 loc) · 801 Bytes
/
Example.py
File metadata and controls
29 lines (20 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def celsiusToFahrenheit(celsius):
return(celsius * 9/5) + 32
def farenheitToCelsius(fahrenheit):
return (fahrenheit - 32)* 5/9
print("Temprature Converter")
print("1. Convert Celsius to Fahrenheit")
print("2. Convert Fahernheit to Celsius")
while True:
x=input("Enter Choice 1/2")
if x == '1':
celsius = float(input("Enter temperature in Celsius:"))
print("Temperature in Fahrenheit:", celsiusToFahrenheit(celsius))
elif x == '2':
fahrenheit = float(input("Enter temperature in Fahrenheit"))
print("Temperature in Celsius:",farenheitToCelsius(fahrenheit))
else:
print("Invalid input")
repeatCalculation = input('Do you want to repeat the calculation? (Y/N): ').strip().upper()
if repeatCalculation == 'N':
break