摘要:
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(9,'A','B','C') 阅读全文
摘要:
l = ['Michael','Bob','Tracy'] l.append('Bob') l.pop() print(1) t = ('Michael','Bob','Tracy') scores = [95,85,65] d = {'Michael':95,'Bob':85,'Tracy':65 阅读全文
摘要:
fr = open('lzr.txt',mode='r',encoding='utf-8') zyx = fr.read() print('明文:' + zyx) print('密文:',end='') for c in zyx: print(chr(ord(c)+3),end='') 阅读全文
摘要:
id= '44011119980513002X' 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 in range(12): print(9... 阅读全文
摘要:
stuNum = '201709080050' print('年级是:'+stuNum[0:4]) print('专业编号是:'+stuNum[4:9]) print('序号是:'+stuNum[-3:]) IDNo= '44011119980513002X' print('省市是:'+IDNo[0:2]) print('生日是:'+IDNo[-8:-4]) print('性别是:'+IDN... 阅读全文
摘要:
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, 110) ... 阅读全文
摘要:
number = 65 while True: guess = int(input('请输入一个数字:')) if guess > number: print('猜的数字大了') elif guess >> import turtle >>> turtle.left(50) >>> turtle.circle(50) >>> turtle.forward... 阅读全文
摘要:
myNumber =65 while True: guess = int(input('请输入数字')) if guess > myNumber: print('输入的数字大了') elif guess < myNumber: print('输入的数字小了') else: print('恭喜你猜对了 阅读全文
摘要:
a=int(input ('摄氏度转换为华氏度请按 1\n华氏度转换为摄氏度请按 2\n')) if a==1: c = float(input('请输入摄氏温度:')) f = c*9/5+32 print('{:.2f}°C转换成华氏温度为{:.2f}°F'.format(c,f)) else: 阅读全文
摘要:
a=input('请输入一个数字:') b=input('请再输入一个数字') sum2=int(a)+int(b) print('两个数字的和是:{}'.format(sum2)) a=input('请输入一个摄氏温度') sum2=int(a)*9/5+32 print('转换的华氏温度是:{}'.format(sum2)) 阅读全文