温度转换(python笔记)

版权声明:如有错误,请指出~ https://blog.csdn.net/FEATHER2016/article/details/77481412
#温度转换程序
#TempConvert.py
val = input("Please input a number")
if val[-1] in ['C', 'c']:
    f = 1.8 * float(val[0:-1]) + 32 
    print("temperature" % f)
elif val[-1] in ['F','f']:
    c = (float(val[0:-1] - 32) / 1.8
    print("temperature" % c)
else:
    print("Error")

33个保留字:
定义变量时,不能与之相同~

name name name name
and elif import raise
as else in return
assert except is try
break finally lambda while
class for nonlocal with
continue from not yield
def globall or True
del if pass False
None
阅读更多
换一批

没有更多推荐了,返回首页