- 博客(8)
- 收藏
- 关注
转载 递归,汉诺塔游戏
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(...
2018-06-14 17:28:00
79
转载 列表、元组、字典、集合的定义、操作与综合练习
l = ['Michael', 'Bob', 'Tracy'] l.append('Bob') l.pop() print(1) t = ('Michael', 'Bob', 'Tracy') scores = [95, 70, 60] d = {'Michael': 95, 'Bob': 70, 'Tracy': 60} d['Bob'] = 82 d[...
2018-06-08 18:28:00
195
转载 文件操作
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='') turtle.speed...
2018-05-30 21:20:00
71
转载 字符串操作
id='440902199706280054' area=id[0:8] birthday=id[6:14] sex=id[-2] print(area,birthday,sex) if(int(sex) % 2 == 0): print('girl') else: print('boy') print(ord('+')) ...
2018-05-23 20:58:00
127
转载 函数定义与使用
stuNum='201709090038' print('年级:'+stuNum[0:4]) print('专业:'+stuNum[4:9]) print('序号:'+stuNum[-3:]) IDNo='440902199706280054' print('性别是:'+IDNo[-2]) print('市区是'+IDNo[0:6]) print('生日是'...
2018-05-16 21:20:00
73
转载 for循环:用turtle画一颗五角星
import turtle turtle. pencolor('blue') turtle. fillcolor('purple') turtle.begin_fill() while True: turtle. forward(100) turtle. right (150) if abs(turtle. position())<1:...
2018-05-09 21:27:00
150
转载 程序执行流程/布尔类型与布尔:运算猜数字游戏;库的使用:turtle
mynumber=50 while True: guess=float(input('请输入一个数字')) if guess>mynumber: print('数字猜大了') elif guess<mynumber: print('数字猜小了') else: print('恭喜...
2018-05-09 19:12:00
108
转载 理解数据类型与数学运算:求和、温度转换2
c= input('请输入摄氏温度') f= float(c)*9/5+32 print('{}摄氏温度转为华氏温度{}'.format(f,c)) 转载于:https://www.cnblogs.com/eric9728eric9728/p/8947418.html
2018-04-25 21:36:00
106
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人