摘要: #1. loveFile = open('love.txt',mode='r',encoding='utf-8') loveText = loveFile.read() loveFile.close() print(loveText) #2. replaceList = [',','.',"'",'\n'] for c in replaceList: loveTxt = loveTex... 阅读全文
posted @ 2018-06-20 21:19 王明哲0 阅读(120) 评论(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(8,'A','B','C') 阅读全文
posted @ 2018-06-13 20:57 王明哲0 阅读(167) 评论(0) 推荐(0) 编辑
摘要: name = ['David','Eva','Tony'] #list print(name[1]) scores = [105,68,70] #list d = {'David':105,'Eva':68,'Tony':70} #dict d['Eva']=88 d['Tony']=78 d.pop('David') print(d) att = {'name': '20170909... 阅读全文
posted @ 2018-06-06 21:41 王明哲0 阅读(125) 评论(0) 推荐(0) 编辑
摘要: fr = open('。。。。。。。',mode='r', encoding='utf-8')plainText = fr.read()print('明文:'+plainText)print('密文:',end='')for c in plainText: print(chr(ord(c)+3),end='') name1='香蕉'name2='葡萄'classmates=['榴莲'... 阅读全文
posted @ 2018-05-30 21:23 王明哲0 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 凯撒密码: 阅读全文
posted @ 2018-05-23 21:37 王明哲0 阅读(189) 评论(0) 推荐(0) 编辑
摘要: import turtleimport mathdef draw_polygon(aTurtle, size=50, n=3): for i in range(n): aTurtle.forward(size) aTurtle.left(360.0/n)def draw_n_angle(aTurtle, size=50, num=5, color=None): ... 阅读全文
posted @ 2018-05-16 21:41 王明哲0 阅读(481) 评论(0) 推荐(0) 编辑
摘要: 玫瑰花:import turtle# 设置初始位置turtle.penup()turtle.left(90)turtle.fd(200)turtle.pendown()turtle.right(90)# 花蕊turtle.fillcolor("blue")turtle.begin_fill()turtle.circle(10, 180)turtle.circle(25, 110)turtle.le... 阅读全文
posted @ 2018-05-09 21:05 王明哲0 阅读(574) 评论(0) 推荐(0) 编辑
摘要: while True: a = int(input('请猜测我的身高(单位:cm)\n')) if a>200: print('对不起,您猜大了,请重新输入') elif a<200: print('对不起,您猜小了,请重新输入') else: a=200 print('恭喜您猜对了') break 阅读全文
posted @ 2018-05-02 21:38 王明哲0 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 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}'.format(c,f)) elif a... 阅读全文
posted @ 2018-04-25 21:30 王明哲0 阅读(220) 评论(0) 推荐(0) 编辑
摘要: a = input('请输入第一个数字:') b = input('请输入第二个数字:') sum = int(a)+int(b) print('两个数的和是:{}'.format(sum)) c = input('请输入一个摄氏温度值:') sum = float(c)*1.8+32 print('该摄氏度转换为华氏度是:{}'.format(sum)) d = input('请输... 阅读全文
posted @ 2018-04-18 21:40 王明哲0 阅读(288) 评论(0) 推荐(0) 编辑