摘要: f = open('Farmer.txt',mode='r',encoding='utf-8') fText = f.read() f.close() replacelist = ['.', ',', "'", '"', '?','\n','\ufeffChapter'] for c in repl 阅读全文
posted @ 2018-06-20 21:32 黄嘉欣 阅读(108) 评论(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(7,'A','B','C') 阅读全文
posted @ 2018-06-13 20:52 黄嘉欣 阅读(118) 评论(0) 推荐(0)
摘要: 描述列表,元组,字典,集合的联系与区别: 阅读全文
posted @ 2018-06-06 21:44 黄嘉欣 阅读(131) 评论(0) 推荐(0)
摘要: fr = open('letter.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('letter.txt', m... 阅读全文
posted @ 2018-05-30 21:43 黄嘉欣 阅读(141) 评论(0) 推荐(0)
摘要: id = '440802199708230442' area = id[0:6] birthday = id[6:14] sex = id[-2] print('市区是:'+area+'\n生日是:'+birthday) if(int(sex) % 2 == 0): print('girl') else: print('boy') for i in range(12):... 阅读全文
posted @ 2018-05-23 20:55 黄嘉欣 阅读(98) 评论(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.goto(x,y) turtle.pendown() def dra... 阅读全文
posted @ 2018-05-16 21:46 黄嘉欣 阅读(100) 评论(0) 推荐(0)
摘要: import turtle turtle.bgcolor('red') turtle.color('yellow') turtle.fillcolor('yellow') turtle.begin_fill() for i in range(5): turtle.forward(100) turtle.right(144) import turtle turtle.f... 阅读全文
posted @ 2018-05-09 21:25 黄嘉欣 阅读(227) 评论(0) 推荐(0)
摘要: number = 18 while True: guess = int(input('请输入一个数字:')) if guess > number: print('>') elif guess >> turtle.fillcolor('purple') >>> turtle.begin_fill() >>> turtle.circle(30) >>> tu... 阅读全文
posted @ 2018-05-05 16:13 黄嘉欣 阅读(228) 评论(0) 推荐(0)
摘要: while True: a =int(input('摄氏温度转换为华氏温度请按 1\n华氏温度转换为摄氏温度请按 2\n')) if a==1: c = float(input('请输入摄氏温度:')) f = c*9/5+32 print('摄氏{:.2f}的华氏为{:.2f}'.format(c,f)) elif a==... 阅读全文
posted @ 2018-04-25 21:33 黄嘉欣 阅读(183) 评论(0) 推荐(0)
摘要: a = input('请输入第一个数字:') b = input('请输入第二个数字:') sum2 = int(a) + int(b) print('两个数的和是:{}'.format(sum2)) a = input('请输入第一个华氏温度:') sum2 = 5/9 * (int(a) -32) print('转换为摄氏温度:{}'.format(sum2)) 阅读全文
posted @ 2018-04-22 13:37 黄嘉欣 阅读(118) 评论(0) 推荐(0)