摘要:
#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... 阅读全文
摘要:
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') 阅读全文
摘要:
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. 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
import turtle # 画一颗五角星 turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forwar 阅读全文
摘要:
mynumber =5 while True: guess = float(input('请输入一个数字:')) if guess > mynumber: print('猜大了') elif guess < mynumber: print('猜小了') else: print('恭喜你,答对啦!') ... 阅读全文
摘要:
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... 阅读全文