Sylvia^^

导航

2018年6月11日 #

期末综合大作业:词频统计

摘要: bigFile = open('big.txt',mode='r',encoding='utf-8') bigText = bigFile.read() bigFile.close() print(bigText) replaceList=[',','.',"'",'\n'] for c in re 阅读全文

posted @ 2018-06-11 17:55 Sylvia^^ 阅读(146) 评论(0) 推荐(0) 编辑

2018年6月4日 #

列表的应用

摘要: import turtle turtle.speed(10) colors = ['red','purple','blue','green','yellow','orange','pink'] for i in range(200): turtle.pencolor(colors[i%7]) turtle.forward(i) turtle.left(59) turt... 阅读全文

posted @ 2018-06-04 16:33 Sylvia^^ 阅读(116) 评论(0) 推荐(0) 编辑

2018年5月28日 #

文件操作

摘要: fr = open('qcj.txt',mode='r',encoding='utf-8') qcj = fr.read() print('明文:'+qcj) print('密文:',end='') fw = open('cipherText.txt',mode='a',encoding='utf-8') for c in qcj: print(chr(ord(c)+3),end='... 阅读全文

posted @ 2018-05-28 17:13 Sylvia^^ 阅读(124) 评论(0) 推荐(0) 编辑

2018年5月21日 #

字符串及其操作

摘要: stuNum = '201709090070' print('年级是:'+stuNum[0:4]) print('专业编号是:'+stuNum[4:8]) print('序号是:'+stuNum[-3:]) IDNum='445224199810230369' print('广东省区编号是:'+IDNum[0:4]) print('惠州市市编号是:'+IDNum[4:6]) prin... 阅读全文

posted @ 2018-05-21 16:25 Sylvia^^ 阅读(172) 评论(0) 推荐(0) 编辑

2018年5月14日 #

while循环与 for循环,函数定义与调用

摘要: 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 d... 阅读全文

posted @ 2018-05-14 16:49 Sylvia^^ 阅读(432) 评论(0) 推荐(0) 编辑

2018年5月7日 #

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) turtle.circle(25, ... 阅读全文

posted @ 2018-05-07 16:07 Sylvia^^ 阅读(400) 评论(0) 推荐(0) 编辑

2018年4月28日 #

程序执行流程:猜数字游戏;库的使用:turtle

摘要: >>> import turtle >>> turtle.circle(50) >>> turtle.circle(100) Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license... 阅读全文

posted @ 2018-04-28 15:57 Sylvia^^ 阅读(427) 评论(0) 推荐(0) 编辑

2018年4月23日 #

条件语句,while循环语句:完整的温度转换程序

摘要: while True: a=input('1:摄氏转华氏\n2:华氏转摄氏\n3:退出\n') if a=='1': celsius=float(inpput('输入摄氏温度:')) fahrenheit=(celsius*9/5)+32 print('{:2f}摄氏温度转为华氏温度为{:.2f}\ 阅读全文

posted @ 2018-04-23 17:04 Sylvia^^ 阅读(190) 评论(0) 推荐(0) 编辑

理解数据类型与数学运算:摄氏温度与华氏温度的转换

摘要: num1=input('输入第一个数字:') num2=input('输入第二个数字:') sum=float(num1)+float(num2) print('数字{0}和{1}相加结果为:{2}'.format(num1,num2,sum)) celsius=float(input('输入摄氏温度:')) fahrenheit=(celsius*1.8)+32#f=c*9/5+32 pr... 阅读全文

posted @ 2018-04-23 16:48 Sylvia^^ 阅读(694) 评论(0) 推荐(0) 编辑

2018年4月16日 #

Mad Libs 游戏

摘要: name1=input('请输入一个名字:') name2=input('再输入一个名字:') print('丑不拉几的{}被美丽的{}给迷得神魂颠倒'.format(name1,name2)) input('press any key') 阅读全文

posted @ 2018-04-16 16:54 Sylvia^^ 阅读(288) 评论(0) 推荐(0) 编辑