程序执行流程:猜数字游戏;库的使用:turtle
>>> import turtle >>> turtle.circle(50) >>> turtle.circle(100)
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import turtle >>> turtle.circle(50) >>> turtle.up() >>> turtle.goto(0,-200) >>> turtle.down() >>> turtle.circle(200) >>> turtle.write(100)
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import turtle >>> turtle.circle(50) >>> turtle.circle(100) >>> turtle.goto(0,-100) >>> turtle.circle(200) >>> turtle.up() >>> turtle.goto(0,-200) >>> turtle.circle(200) >>> turtle.clear() >>> turtle.reset() >>> turtle.circle(100,180) >>> turtle.circle(100,180,steps=3) >>> turtle.up() >>> turtle.goto(0,60) >>> turtle.circle(20) >>> turtle.down() >>> turtle.circle(20) >>> turtle.up() >>> turtle.goto(15,80) >>> turtle.goto(20,90) >>> turtle.goto(20,120) >>> turtle.goto(20,110) >>> turtle.circle(15) >>> turtle.down() >>> turtle.circle(15) >>> turtle.hideturtle()
myNum=7 print('猜数字游戏\n') while True: guess=int(input('请猜一个数:')) if guess>myNum: print('猜大了') elif guess<myNum: print('猜小了') else: print('恭喜你,猜对了!') break