摘要: 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(3,'A','B','C') 阅读全文
posted @ 2018-06-13 21:19 CarmenWong 阅读(126) 评论(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'... 阅读全文
posted @ 2018-05-30 20:39 CarmenWong 阅读(123) 评论(0) 推荐(0) 编辑
摘要: id = '440105199805230066' 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(ord('+')) print(chr(9800)) ... 阅读全文
posted @ 2018-05-23 20:19 CarmenWong 阅读(122) 评论(0) 推荐(0) 编辑
摘要: stuNum = '201709090049' print('年级是:'+stuNum[0:4]) print('专业编号是:'+stuNum[4:9]) print('序号是:'+stuNum[-3:]) IDNo= '440301199808130621' print('省市是:'+IDNo[0 阅读全文
posted @ 2018-05-23 19:58 CarmenWong 阅读(85) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.bgcolor('red') turtle.pencolor('yellow') turtle.fillcolor('yellow') turtle.begin_fill() for i in range(5): turtle.forward(200) turtle.right(144) turtle.end_fill() turtl... 阅读全文
posted @ 2018-05-09 20:49 CarmenWong 阅读(144) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.penup() turtle.left(90) turtle.fd(200) turtle.pendown() turtle.right(90) turtle.fillcolor('red') turtle.begin_fill() turtle.circle(10,180) turtle.circle(25,110) turtle.left(50) t... 阅读全文
posted @ 2018-05-02 21:47 CarmenWong 阅读(131) 评论(0) 推荐(0) 编辑
摘要: while True: a = int(input('摄氏转华氏请按1 华氏转摄氏请按2 退出请按3')) if a==1: c = float(input('请输入摄氏温度:')) f = c*9/5+32 print('摄氏{:.2f}的华氏为{:.2f}\n'.format(c,f)) eli 阅读全文
posted @ 2018-04-25 21:33 CarmenWong 阅读(233) 评论(0) 推荐(0) 编辑
摘要: a = input('1.摄氏转华氏 2.华氏转摄氏') if a == '1': c = input('请输入摄氏温度:') f = float(c)*9/5+32 print('{}摄氏温度转为华氏温度是{}'.format(c,f)) else: f = float(input('请输入华氏温度:')) c = 5/9*(f-32) prin... 阅读全文
posted @ 2018-04-25 20:47 CarmenWong 阅读(281) 评论(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:17 CarmenWong 阅读(104) 评论(0) 推荐(0) 编辑
摘要: name1=input('请输入一个人名') name2=input('请输入一个人名') print('{},精力旺盛,连续打24小时的王者荣耀都不觉得累,{}打1个小时就觉得自己精神恍惚了'.format(name1,name2)) 阅读全文
posted @ 2018-04-18 20:46 CarmenWong 阅读(132) 评论(0) 推荐(0) 编辑