9

摘要: import turtle turtle.speed(10) colors = ['#FF8C69','#BCD2EE','#8B636C','#CDCDC1','#C67171','#FAFAD2','#E8E8E8','#F08080','#EEC591','#CDC673','#CAFF70' 阅读全文
posted @ 2018-06-04 15:37 多多- 阅读(106) 评论(0) 推荐(0) 编辑

文件操作

摘要: fr = open('wwww.txt',mode='r',encoding='utf-8') plainText = fr.read() print('明文:'+plainText) print('密文:',end='') for c in plainText: print(chr(ord(c)+ 阅读全文
posted @ 2018-05-28 16:16 多多- 阅读(72) 评论(0) 推荐(0) 编辑

字符串及其操作1

摘要: for i in range(12): print(9800+i,chr(9800+i)) stuNum = '201709080045' print('年级是:'+stuNum[0:4]) print('专业编号是:'+stuNum[4:9]) print('序号是:'+stuNum[-3:]) stuNum = '440104199610264729' print('所在省市:... 阅读全文
posted @ 2018-05-28 15:18 多多- 阅读(66) 评论(0) 推荐(0) 编辑

while循环与 for循环

摘要: import turtle while True: turtle.forward(80) turtle.right(68) if (abs(turtle.pos()))<1: break turtle.done() 阅读全文
posted @ 2018-05-14 15:24 多多- 阅读(113) 评论(0) 推荐(0) 编辑

for循环:用turtle画一颗五角星

摘要: import turtle turtle.setup(600,400,0,0) turtle.bgcolor('yellow') turtle.color("black") turtle.fillcolor("yellow") turtle.begin_fill() for i in range(5 阅读全文
posted @ 2018-05-14 15:14 多多- 阅读(162) 评论(0) 推荐(0) 编辑

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

摘要: myNum = 9 print('猜数字游戏\n') while True: guess = int(input('请猜一个数:')) if guess > myNum: print('猜大了') elif guess < myNum: print('猜小了') else: print('恭喜你,猜 阅读全文
posted @ 2018-05-07 15:40 多多- 阅读(180) 评论(0) 推荐(0) 编辑

完整的温度转换程序

摘要: a=input('摄氏度转换为华氏温度请按1\n华氏温度转化为摄氏度请按2\n') if a=='1': celsius=float(input('请输入摄氏温度:')) fahrenheit=(celsius*9/5)+32 print('{:2f}摄氏温度转为华氏温度为{:.2f}'.forma 阅读全文
posted @ 2018-04-23 17:18 多多- 阅读(466) 评论(0) 推荐(0) 编辑

理解数据类型与数学运算

摘要: >>> a=input('请输入一个数字') 请输入一个数字999 >>> b=input('请输入另一个数字') 请输入另一个数字888 >>> suml=int(a)+int(b) >>> print('二数之和是:{}'.format(suml)) 二数之和是:1887 >>> a=input 阅读全文
posted @ 2018-04-23 17:14 多多- 阅读(112) 评论(0) 推荐(0) 编辑

Mad libs

摘要: 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()" for more infor 阅读全文
posted @ 2018-04-16 16:41 多多- 阅读(234) 评论(0) 推荐(0) 编辑