- 博客(10)
- 收藏
- 关注
转载 期末综合大作业:词频统计
geFile = open("ge.txt",mode="r",encoding='utf-8')geText = geFile.read()geFile.close()print(geText)replaceList = [',','.',"'",'\n']for c in replaceList: geText = geText.replace(...
2018-06-20 20:49:00
81
转载 递归,汉诺塔游戏
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')转载于:htt...
2018-06-13 20:56:00
84
转载 列表、元组、字典、集合的定义、操作与综合练习
l = ['QQ','WW','EE']l.append('WW')l.pop()print(1)t = ('QQ','WW','EE')scores = [95,25,20]d = {'QQ':95,'WW':25,'EE':20}d['QQ'] = 44d['WW'] = 55d.pop('EE')print(d)s...
2018-06-06 21:40:00
94
转载 文件操作
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 = ope...
2018-05-30 21:18:00
110
转载 字符串操作
id = '440882199902023256'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 i...
2018-05-23 21:10:00
54
转载 函数定义与使用
import turtleturtle.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.p...
2018-05-16 20:39:00
160
转载 for循环:用turtle画一颗五角星
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)...
2018-05-09 20:30:00
141
转载 条件语句,while循环语句:完整的温度转换程序
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}'....
2018-04-25 21:49:00
298
转载 理解数据类型与数学运算:求和、温度转换
a=input('请输入一个数')b=input('再次输入一个数')sum1=int(a)+int(b)print('两个数之和{}'.format(sum1))a=input('输入摄氏温度:')sum1=int(a) * 9/5 +32print('华氏温度为{}'.format(sum1))转载于:https://www.c...
2018-04-18 21:45:00
72
转载 输入、输出与Mad Libs 游戏
name1=input('请输入一个名字')name2=input('请输入一个连词')print('{}吃了一根香肠,{}吸了一根烟,他感到很满足'.format(name1,name2))转载于:https://www.cnblogs.com/chenyifan666/p/8877571.html...
2018-04-18 21:08:00
64
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人