摘要: #(1)遍历列表 print('列表的遍历:') a=[1,2,3]; for i in a: print(i); #(2)遍历元组 print('元组的遍历:') a=(4,5,6); for i in a: print(i); #(3)遍历集合 print('集合的遍历:') a={7,8,9} for i in a: print(i); #(4)遍历字典 print(... 阅读全文
posted @ 2018-10-08 19:59 张震34 阅读(106) 评论(0) 推荐(0) 编辑
摘要: a=int(input("摄氏度转华氏度按1\n华氏度转摄氏度按2\n")) if a==1: name1=float(input('输入摄氏温度:')) name2=(name1*1.8)+32 print('{}摄氏度转为华氏度为:{}'.format(name1,name2)) else: name3 = float(input('输入华氏温度:')) ... 阅读全文
posted @ 2018-09-10 10:44 张震34 阅读(90) 评论(0) 推荐(0) 编辑