while True: a=int(input(‘摄氏温度转华氏温度请按1\n华氏温度转摄氏温度请按2:\n‘)) if a == 1: celsius = float(input(‘输入摄氏温度:‘)) fahrenheit = (celsius * 1.8)+32 print(‘{:.2f}摄氏温度转为华氏温度为{:.2f}‘.format(celsius,fahrenheit)) elif a == 2: fahrenheit = float(input(‘输入华氏温度:‘)) celsius = 5/9*(fahrenheit - 32) print(‘{:.2f}华氏温度转为摄氏温度为{:.2f}‘.format(fahrenheit,celsius)) else: break
n=14 a=-1 while (a!=n): a=int(input(‘请输入年龄:‘)) if a==n: print(‘恭喜你答对了‘) elif a>n: print(‘很遗憾你猜大了‘) else: print(‘很遗憾你猜错了‘)
s=‘441481199710011589‘ age=2018-int(s[6:10]) print(‘年龄:‘+str(age)) if int(s[-2]) % 2 == 0: sex ="女孩" else: sex ="男孩" print("性别:"+sex) a=s[:2] print(‘省编号:‘+a) b=s[2:4] print(‘市编号:‘+b)
a=‘asdfghjk‘ for c in a: print(c)
for i in range(4,10,3): print(‘https://news.gzcc.cn/html/xiaoyuanxinwen/{}.html‘.format(i))
原文地址:https://www.cnblogs.com/h000/p/9643343.html
时间: 2024-10-29 11:09:58