代码改变世界

随笔档案-2018年05月

文件操作,列表实例NiceHexSpiral

2018-05-30 20:53 by 陈俊宇A, 193 阅读, 收藏,
摘要: import turtle turtle. speed(10) colors = ['purple','yellow','red','green','blue','orange'] for i in range(200): turtle.pencolor(colors[i% 6]) turtle.forward(i) turtle.right(59) turtle.d... 阅读全文

字符串操作

2018-05-23 21:21 by 陈俊宇A, 170 阅读, 收藏,
摘要: id='441900199908060015' sex=id[-2] print('性别') if (int(sex)%2==0): print('gril') else: print('boy') for i in range (12): print(9800+i,chr(9800+i)) b = input('明文') for c in b: ... 阅读全文

函数定义与使用,字符串类型2

2018-05-16 21:35 by 陈俊宇A, 234 阅读, 收藏,
摘要: 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() ... 阅读全文

函数定义与使用,字符串类型

2018-05-16 21:30 by 陈俊宇A, 276 阅读, 收藏,
摘要: stuNum='201709080036' print('年级是:'+stuNum[0:4]) print('专业编号是:'+stuNum[4:9]) print('序号是:'+stuNum[-3:]) IDNo='441900199908060015' print('省市'+IDNo[0:2]) 阅读全文

函数定义与使用

2018-05-16 20:47 by 陈俊宇A, 113 阅读, 收藏,
摘要: import turtle turtle.setup(600,400,0,0) turtle.bgcolor('red') turtle.color('yellow') turtle.fillcolor('yellow') def mygoto(x,y): turtle.penup() turtle 阅读全文

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

2018-05-09 20:48 by 陈俊宇A, 191 阅读, 收藏,
摘要: import turtle turtle.bgcolor('red') turtle.color('yellow') turtle.fillcolor('yellow') turtle.begin_fill() for i in range(5): turtle.forward(100) turtl 阅读全文

库的使用:turtle

2018-05-02 21:38 by 陈俊宇A, 905 阅读, 收藏,
摘要: >>> turtle.right(180) >>> turtle.forward(100) >>> turtle.circle(100) >>> turtle.circle(50) >>> turtle.circle <function circle at 0x02D90B70> >>> turtl 阅读全文

程序执行流程/布尔类型与布尔:运算猜数字游戏;库的使用:turtle

2018-05-02 20:37 by 陈俊宇A, 139 阅读, 收藏,
摘要: myNumber=6 while True: guess=int(input('猜年龄')) if guess>myNumber: print('大了一点') elif guess<myNumber: print('小了一点') else: print('对了') break 阅读全文