Skip to content

Commit d0e42d4

Browse files
committed
add temp.py
1 parent cfeac76 commit d0e42d4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

temp.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# TempConvert.py
2+
val =input("Please input the temp with temprature symbol: ")
3+
if val[-1] in ['C','c']:
4+
f = 1.8 * float(val[0:-1])+32
5+
print("The converted temorature is: %.2fF"%f)
6+
elif val[-1] in ['F','f']:
7+
c = (float(val[0:-1])-32)/1.8
8+
print("The converted temprature is: %.2fC"%c)
9+
else:
10+
print("wrong input")

0 commit comments

Comments
 (0)