- 博客(17)
- 收藏
- 关注
转载 大作业
f = open('歌词.txt',mode='r',encoding='utf-8')fText = f.read()f.close()print(fText)If I got down on my knees And I pleaded with you If I cross a million oceans Just to be with y...
2018-06-13 21:49:00 121
转载 递归,汉诺塔游戏
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(5,'A','B','C')1 A->...
2018-06-13 20:29:00 103
转载 列表、元组、字典、集合的定义与操作
l = ['Michael','Bob','Tracy']l.append('Rose')l.pop()t = ('Michael','Bob','Tracy')print(l)['Michael', 'Bob', 'Tracy']scores = [90,80,70]d = {'Michael':90,'Bob':80,'Tracy'...
2018-06-06 21:43:00 167
转载 列表实例NiceHexSpiral
classmates = ['Michael','Bob','Tracy']classmates.append('Rose')classmates.insert(1,'Jack')classmates.pop()classmates.pop(0)classmates[0] = 'Tom'print(classmates)['Tom', 'B...
2018-05-30 21:37:00 120
转载 文件操作,列表实例NiceHexSpiral
fr = open('letter.txt.txt', mode='r', encoding='utf-8')plaincode = fr.read()print('明文:' + plaincode)print('密文:', end='')for c in plaincode: print(chr(ord(c)+3),e...
2018-05-30 21:29:00 88
转载 凯撒密码
s = input('明文:')for c in s: print(chr(ord(c)+3),end='')明文:i love youl#oryh#|rxProcess finished with exit code 0s = input('密文:')for c in s: print(chr(ord(c)-3),end=...
2018-05-23 21:09:00 185
转载 字符的Unicode编码
for i in range(12): print(i,chr(9800+i))0 ♈1 ♉2 ♊3 ♋4 ♌5 ♍6 ♎7 ♏8 ♐9 ♑10 ♒11 ♓转载于:https://www.cnblogs.com/Millie/p/9079123.html...
2018-05-23 20:19:00 112
转载 字符串操作
id = '440711199809024227'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')年级是:2017专业...
2018-05-23 20:15:00 75
转载 作业2
stuNum = '201709090008'print('年级是:'+stuNum[0:4])print('专业编号是:'+stuNum[4:9]print('序号是:'+stuNum[-3:])IDNo = '440711199809024227'print('性别是:'+IDNo[2])print('市区是:'+IDNo[0:6])print('...
2018-05-16 21:50:00 83
转载 函数定义与使用
import turtle#画一个五角星turtle. setup(600,400,0,0)turtle.bgcolor('red')turtle.pencolor('yellow')turtle.fillcolor('yellow')def mygoto(x,y): turtle.penup() turtle.goto(x,y)...
2018-05-16 21:20:00 111
转载 for循环:用turtle画一颗五角星
import turtleturtle.bgcolor('red')turtle.pencolor('yellow')turtle.fillcolor('yellow')turtle.begin_fill()for i in range(5): turtle.forward(100) turtle.right...
2018-05-09 20:49:00 1546
转载 程序执行流程/布尔类型与布尔:运算猜数字游戏;库的使用:turtle
import turtleturtle.circle(50)turtle.circle(52)turtle.circle(54)turtle.circle(56)turtle.circle(58)turtle.done转载于:https://www.cnblogs.com/Millie/p/8982720.html
2018-05-02 21:52:00 110
转载 程序执行流程/布尔类型与布尔:运算猜数字游戏;
myNumber = 5while True: guess = int(input('请输入一个数字')) if guess > myNumber: print('大了') elif guess < myNumber: print('小了') else: print('恭...
2018-05-02 21:28:00 135
转载 条件语句,while循环语句:完整的温度转换程序
while True: a = input('1.摄氏转华氏 \n 2.华氏转摄氏') if a =='1': c=input('请输入摄氏温度:') f=float('{}摄氏温度转为华氏温度是{}'.format(c,'f'))*9/5+32 print(f) elif: a =='2': ...
2018-04-25 21:44:00 335
转载 温度
a = input('1.摄氏转华氏 \n 2.华氏转摄氏')if a =='1': c=input('请输入摄氏温度:') f=float('{}摄氏温度转为华氏温度是{}'.format(c,f))*9/5+32 print(f)else: f = float(input('请输入华氏温度:')) c=5/9*(f-32)...
2018-04-25 21:12:00 88
转载 理解数据类型与数学运算:求和、温度转换
a = input('请输入一个数')b = input('请输入第二个数')sum2=int(a) + int(b)print('两个数的和是:{}'.format(sum2))a = input('请输入一个摄氏温度')sum2=int(a) * 9/5 +32print('转换的华氏温度是:{} '.format(sum2))...
2018-04-18 21:53:00 82
转载 输入、输出与Mad Libs 游戏
name1 = input ('请输入一个人的名字')name2 = input ('再输入一个人的名字') print('一个叫{}的女生,在和{}吃鸡'.format(name1, name2))转载于:https://www.cnblogs.com/Millie/p/8877702.html...
2018-04-18 21:27:00 90
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人