python库turtle应用实践

1.画正方形

import turtle as t
t.setup(400,400)
for i in range(4):
    a = i*90
    t.seth(a)
    t.fd(40)
t.done

2.画六边形

import turtle as t
t.setup(400,400)
for i in range(6):
    a = i*60
    t.seth(a)
    t.fd(40)
t.done

3.画叠边形

import turtle as t
t.setup(400,400)
for i in range(9):
    t.fd(60)
    t.left(80)
t.done

 

转载于:https://my.oschina.net/u/3993068/blog/2243668

你可能感兴趣的:(python库turtle应用实践)