2018年1月22日

作业4(列表增加或者修改)

摘要: friends=[] #定义空列表 for i in range(5): #循环五次,输入五次名称 friends.append(raw_input()) #用户输入增加列表数据 # new=sorted(friends) #新定义有序副本new # # print "friend... 阅读全文

posted @ 2018-01-22 14:26 新手爱好者 阅读(98) 评论(0) 推荐(0) 编辑

字典

摘要: python27运行后显示错误:(SyntaxError: can't assign to literal)语法错误:不能指定为字符。不知为何。 根据百度查询,修改代码如下: 显示运行正常。 mary: 555-6789 {'bob': '444-4321', 'john': '555-1234', 阅读全文

posted @ 2018-01-22 10:46 新手爱好者 阅读(145) 评论(1) 推荐(0) 编辑

2018年1月19日

作业3

摘要: # -*- coding: UTF-8 -*- import time a=int(raw_input("输入倒计时: ",)) for i in range(a,0,-1): print i, print '*'*i time.sleep(1) print "off" 阅读全文

posted @ 2018-01-19 16:56 新手爱好者 阅读(82) 评论(0) 推荐(0) 编辑

作业2

摘要: 1 i=raw_input() 2 i=int(i) 3 b=1 4 c=raw_input() 5 c=int(c) 6 while b<=c: 7 a=i*b 8 print i,"x",b,"=",a 9 b=b+1 阅读全文

posted @ 2018-01-19 16:55 新手爱好者 阅读(67) 评论(0) 推荐(0) 编辑

作业1

摘要: 1 # -*- coding: UTF-8 -*- 2 import easygui 3 4 a=float(easygui.buttonbox("请输入性别.说明男孩选择1,女孩选择2",choices=['1','2'])) 5 if a==2: 6 b=float(easygui.enterbox("输入年龄")) 7 if 10<=b<=12: 8 ... 阅读全文

posted @ 2018-01-19 16:50 新手爱好者 阅读(90) 评论(0) 推荐(0) 编辑

导航