2018年6月20日

摘要: #1 f = open('Les Miserables悲惨世界.txt',mode='r',encoding='utf-8') fText = f.read()#从文件里独处全部文本,字符串 print(fText) #2 replacelist = ['?','.',',',':','"',"'"] for c in replacelist: fText = fText.replac... 阅读全文
posted @ 2018-06-20 21:38 梁梓蕙 阅读(114) 评论(0) 推荐(0)

2018年6月13日

摘要: 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(5,'A','B','C') 阅读全文
posted @ 2018-06-13 20:54 梁梓蕙 阅读(121) 评论(0) 推荐(0)

2018年6月6日

摘要: l=['Michael','Bob','Tracy'] l.append('Bob') l.pop() print(l) t = ('Michael', 'Bob', 'Tracy') scores=[95 ,75 ,85] d = {'Michael':95, 'Bob':75, 'Tracy': 阅读全文
posted @ 2018-06-06 21:43 梁梓蕙 阅读(78) 评论(0) 推荐(0)

2018年5月30日

摘要: fr = open('Alice.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('Alice.txt', mode='... 阅读全文
posted @ 2018-05-30 21:44 梁梓蕙 阅读(141) 评论(0) 推荐(0)

2018年5月23日

摘要: id='440681199806140226' 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') for i in range(12): print(9800+i,chr(9... 阅读全文
posted @ 2018-05-23 20:57 梁梓蕙 阅读(99) 评论(0) 推荐(0)

2018年5月16日

摘要: import turtle turtle.setup(600,400,0,0) turtle.bgcolor('red') turtle.pencolor('yellow') turtle.fillcolor('yellow') def mygoto(x,y): turtle.penup() turtle.goto(x,y) turtle.pendown() myg... 阅读全文
posted @ 2018-05-16 21:46 梁梓蕙 阅读(247) 评论(0) 推荐(0)

2018年5月9日

摘要: import turtle turtle.pencolor('pink') turtle.fillcolor('pink') turtle.begin_fill() for i in range(5): turtle.forward(100) turtle.right(144) turtle.end_fill() turtle.done() 阅读全文
posted @ 2018-05-09 21:24 梁梓蕙 阅读(130) 评论(0) 推荐(0)

2018年5月3日

摘要: number = 27 while True: guess =int(input('请输入一个数字:')) if guess > number: print('输入的数有点大') elif guess < number: print('输入的数有点小') else: guess = number p 阅读全文
posted @ 2018-05-03 23:16 梁梓蕙 阅读(114) 评论(0) 推荐(0)

2018年4月25日

摘要: 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'.forma 阅读全文
posted @ 2018-04-25 21:30 梁梓蕙 阅读(118) 评论(0) 推荐(0)

2018年4月20日

摘要: 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-20 19:32 梁梓蕙 阅读(103) 评论(0) 推荐(0)

导航