mardi 3 septembre 2019

Drawing something if an input is "day"

I'm trying to make a turtle do something if my input is "day" or "night".

import turtle
t = turtle.Pen()
def drawSun(size):
    t.fillcolor("gold")
    t.begin_fill()
    t.circle(size)
    t.end_fill()

def drawMoon(size):
    t.fillcolor("white")
    t.begin_fill()
    t.circle(size)
    t.end_fill()
if time = "Day"():
    t.penup()
    t.goto(30, 150)
    t.pendown()
    drawSun(50)

if time = "Night"():
    t.penup()
    t.goto(30, 150)
    t.pendown()
    drawMoon(50)

I get an error about the if line, but I can't figure out what is wrong.

Aucun commentaire:

Enregistrer un commentaire