摘要: #1. jFile = open('j.txt',mode='r',encoding='utf-8') jText = jFile.read() jFile.close() print(jText) #2. replaceList = [',',"'",'-','\n'] for c in repl 阅读全文
posted @ 2018-06-20 20:43 刘海茵 阅读(153) 评论(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) 阅读全文
posted @ 2018-06-13 21:07 刘海茵 阅读(147) 评论(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 阅读全文
posted @ 2018-06-06 21:25 刘海茵 阅读(173) 评论(0) 推荐(0) 编辑
摘要: fr = open('12333.txt',mode='r',encoding='utf-8') plaincode = fr.read() print('明文:' + plaincode) print('密文:',end='') for c in plaincode: print(chr(ord(c)+3),end='') fr = open('12333.txt',mode='... 阅读全文
posted @ 2018-05-30 21:15 刘海茵 阅读(125) 评论(0) 推荐(0) 编辑
摘要: id ='441323199901153026' area =id[0:6] birthday =id[6:14] sex =id[-2] print(area,birthday,sex) if (int(sex) %2 ==0): print('girl') else: print('boy') print('+') print(chr(9800)) print(... 阅读全文
posted @ 2018-05-23 20:56 刘海茵 阅读(124) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.setup(600,400,0,0) turtle.bgcolor('red') turtle.color('yellow') turtle.fillcolor('yellow') def mygoto(x,y): turtle.penup() turtle 阅读全文
posted @ 2018-05-16 20:36 刘海茵 阅读(125) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.setup(800,400,0,0) turtle.bgcolor('pink') turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forw 阅读全文
posted @ 2018-05-09 20:18 刘海茵 阅读(104) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.circle(100) turtle.circle(90) turtle.circle(80) turtle.circle(70) turtle.circle(60) turtle.color('red') myNumber = 9 while True: guess=int(input()) if guess > myNumbe... 阅读全文
posted @ 2018-05-02 21:15 刘海茵 阅读(189) 评论(0) 推荐(0) 编辑
摘要: a=int(input ('摄氏度转换为华氏度请按 1\n华氏度转换为摄氏度请按 2\n')) if a==1: c = float(input('请输入摄氏温度:')) f = c*9/5+32 print('{:.2f}°C转换成华氏温度为{:.2f}°F'.format(c,f)) else: 阅读全文
posted @ 2018-04-25 21:03 刘海茵 阅读(365) 评论(0) 推荐(0) 编辑
摘要: >>> a=input('请输入一个数') 请输入一个数5 >>> print(a) 5 >>> a=input('请输入一个数;') 请输入一个数;5 >>> print(a) 5 >>> type(a) >>> a=input('请输入一个摄氏温度;') >>> sum2=int(a)*9/5+32 >>> print('转换的华氏温度是;[]'.format(sum2)) ... 阅读全文
posted @ 2018-04-25 20:39 刘海茵 阅读(113) 评论(0) 推荐(0) 编辑