11-18 画日期
import turtle, datetimedef drawLine1(draw):turtle.pendown() if draw else turtle.penup()turtle.fd(40)turtle.right(90)def drawDigit1(digit):drawLine1(True) if digit in [2, 3, 4, 5, 6, 8, 9] else drawLin
·
import turtle, datetime
def drawLine1(draw):
turtle.pendown() if draw else turtle.penup()
turtle.fd(40)
turtle.right(90)
def drawDigit1(digit):
drawLine1(True) if digit in [2, 3, 4, 5, 6, 8, 9] else drawLine1(False)
drawLine1(True) if digit in [0, 1, 3, 4, 5, 6, 7, 8, 9] else drawLine1(False)
drawLine1(True) if digit in [0, 2, 3, 5, 6, 8, 9] else drawLine1(False)
drawLine1(True) if digit in [0, 2, 6, 8] else drawLine1(False)
turtle.left(90)
drawLine1(True) if digit in [0, 4, 5, 6, 8, 9] else drawLine1(False)
drawLine1(True) if digit in [0, 2, 3, 5, 6, 7, 8, 9] else drawLine1(False)
drawLine1(True) if digit in [0, 1, 2, 3, 4, 7, 8, 9] else drawLine1(False)
turtle.left(180)
turtle.penup()
turtle.fd(20)
def drawDate1(date):
for i in date:
drawDigit1(eval(i))
def main1():
turtle.setup(800, 350, 200, 200)
turtle.penup()
turtle.fd(-400)
turtle.pensize(5)
drawDate1(datetime.datetime.now().strftime('%Y%m%d'))
turtle.hideturtle()
main1()
运行结果
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献1条内容
所有评论(0)