摘要: #1 weFile =open('we.tet',mode='r',encoding='utf-8') weText =weFile.read() #从文件里读出全部文本,字符串 weFile.close() print(weText) #2 replaceList =[',','.',"'",'\n'] for c in replaceList: weText = weText.r... 阅读全文
posted @ 2018-06-20 21:15 王佳涵 阅读(130) 评论(0) 推荐(0) 编辑
摘要: def hanoi(n,a,b,c): if n==1: print(n,a+'->'+c) else: hanoi(n-1,a,c,b) print(n,a+'->'+c) hanoi(n-1,b,a,c) hanoi(8,'A','B','C') 阅读全文
posted @ 2018-06-13 21:24 王佳涵 阅读(176) 评论(0) 推荐(0) 编辑
摘要: l = ['Michael','Bob','Tracy'] l.append('Bob') l.pop() print(1) t = ('Michael','Bob','Tracy') scores = [95,75,85] d = {'Michael':95,'Bob':75,'Tracy':85} d['Bob'] = 82 d['Rose'] = 88 d.pop('Bob') p. 阅读全文
posted @ 2018-06-06 21:37 王佳涵 阅读(124) 评论(0) 推荐(0) 编辑
摘要: fr = open('12333.txt',mode='r',encoding='utf-8') plaincode = fr.read() fr.close fw = open('c_12333.txt',mode='a',encoding='utf-8') for c in plaincode: fw.write(chr(ord(c)+3)) fw.close fr... 阅读全文
posted @ 2018-05-30 21:39 王佳涵 阅读(99) 评论(0) 推荐(0) 编辑
摘要: id ='440182199906183927' area = id[0:6] birthday =id[6:14] sex =id[-2] print(area,birthday,sex) if (int(sex)%2==0): print('girl') else: print('bpy') stuNum='201709090057' print('年级是:'+st... 阅读全文
posted @ 2018-05-23 21:12 王佳涵 阅读(195) 评论(0) 推荐(0) 编辑
摘要: import turtle # 画一颗五角星 turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forwar 阅读全文
posted @ 2018-05-09 21:33 王佳涵 阅读(158) 评论(0) 推荐(0) 编辑
摘要: mynumber =5 while True: guess = float(input('请输入一个数字:')) if guess > mynumber: print('猜大了') elif guess < mynumber: print('猜小了') else: print('恭喜你,答对啦!') ... 阅读全文
posted @ 2018-05-02 21:41 王佳涵 阅读(344) 评论(0) 推荐(0) 编辑
摘要: while True: a = int(input('摄氏转华氏请按 1\n华氏转摄氏请按 2\n退出请按 3\n')) if a==1: c = float(input('请输入摄氏温度:')) f = c*9/5+32 print('摄氏{:.2f}的华氏为{:.2f}\n'.format(c,f)) elif a==2... 阅读全文
posted @ 2018-04-25 21:47 王佳涵 阅读(147) 评论(0) 推荐(0) 编辑
摘要: a=input("请输入第一个数:") b=input('请输入第二个数:') sum2=int(a)+int(b) print('两个数的和是:{}'.format(sum2)) a=input('请输入一个摄氏温度') sum2=int(a)*9/5+32 print('转换的华氏温度是:{}'.format(sum2)) 阅读全文
posted @ 2018-04-18 21:42 王佳涵 阅读(138) 评论(0) 推荐(0) 编辑
摘要: name1=input('请输入一个名字:') name2=input('再输入一个名字:') print('{}是一个开朗热情乐观的女孩,而{}是一个内向悲观的女孩,但她们是好朋友'.format(name1,name2)) 阅读全文
posted @ 2018-04-18 20:41 王佳涵 阅读(131) 评论(0) 推荐(0) 编辑