赞
踩
正在看书自学中,贴出自己的作业,欢迎大家交流指正,一起进步~
# TempConvert
def TempConvert(value):
if tempstr[-1] in ['F','f']:
c = (eval(tempstr[0:-1]) - 32)/1.8
print ("The temperature is converted to {}C".format(int(c)))
elif tempstr[-1] in ['C','c']:
f = eval(tempstr[0:-1])*1.8 + 32
print("The temperature is converted to {}F".format(int(f)))
else:
print("Input wrong!")
tempstr = input("pls input the temperature with unit F or C: ")
while tempstr[-1] not in ['N','n']:
TempConvert(tempstr)
tempstr = input(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。