标签:pre eve src 定义函数 img ide log logs turn
1.def fahrenheit_converter(C):
fahrenheit = C * 9/5 +32
return str(fahrenheit) + ‘°F‘ """摄氏度转华氏度"""
C2F = fahrenheit_converter(35)
print(C2F)
2.def kilogram_to_gram(kg):
gram = kg*1000
return str(gram) + ‘g‘"""千克转克"""
print(kilogram_to_gram(20))
3.def right_bevel(a,b):
bevel = (a**2 + b**2)**(1/2)
return ‘The right triangle third side\‘s length is ‘ + str(bevel) + ‘cm‘
print(right_bevel(3,4))
print(right_bevel(a=3,b=4))#已知直边求斜边
标签:pre eve src 定义函数 img ide log logs turn
原文地址:http://www.cnblogs.com/Jiang190/p/6721909.html