用户:MC-方块喵喵侠查看:0 回复:0 评论:0 创建时间:2023-01-21T21:02:05
【作品展示】

【作品介绍】
摄氏度和华氏度的转换(我用电脑,只好用锁屏)
【作品源代码】
while True:
a = int(input('摄氏度→华氏度请按1\n华氏度→摄氏度请按2\n'))
while a != 1 and a != 2:
a = int(input('2\n摄氏度→华氏度请按1\n华氏度→摄氏度请按2\n'))
if a == 1:
c = float(input('输入摄氏度:'))
f = (c * 1.8) + 32 #计算华氏度
print('%.1f摄氏度转换为华氏度为%1f'%(c,f))
else:
f = float(input('输入华氏度:'))
c = (f - 32) / 1.8 #计算摄氏度
print('%.1f华氏度转换为摄氏度为%1f'%(f, c))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn