05 2018 档案

文件操作
摘要: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='') fr = open('ccc.txt',mod... 阅读全文

posted @ 2018-05-30 21:23 刘婵 阅读(101) 评论(0) 推荐(0)

字符串操作
摘要:id= '36072319990616004X' area = id[0:6] birthday = id[6:16] sex = id[-2] print(area,birthday,sex) if (int(sex) % 2 == 0): print('girl') else: print('boy') for i in range(12): print(9... 阅读全文

posted @ 2018-05-23 21:12 刘婵 阅读(101) 评论(0) 推荐(0)

函数定义与使用
摘要: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() ... 阅读全文

posted @ 2018-05-16 20:36 刘婵 阅读(97) 评论(0) 推荐(0)

for循环:用turtle画一颗五角星
摘要:import turtle turtle.bgcolor('red') turtle.pencolor('yellow') turtle.fillcolor('yellow') turtle.begin_fill() for i in range(5): turtle.forward(100) tu 阅读全文

posted @ 2018-05-09 20:56 刘婵 阅读(139) 评论(0) 推荐(0)

程序执行流程/布尔类型与布尔:运算猜数字游戏;库的使用:turtle
摘要:myNumber = 13 while True: guess = int(input('请输入一个数量:')) if guess > myNumber: print('输入的数量过大') elif guess >> import turtle >>> turtle.circle(50,steps=6) >>> turtle.color('yellow'... 阅读全文

posted @ 2018-05-02 21:38 刘婵 阅读(133) 评论(0) 推荐(0)

导航