Branham-Computer-Science-23-24 / Dropping-the-Bomb

MIT License
0 stars 0 forks source link

Password #5

Open LleytonH opened 6 months ago

LleytonH commented 6 months ago

Create a password that when entered correctly will do something.

LleytonH commented 6 months ago

----Password set up----

entered = "" armed = False

def Password(): global armed if (entered == "42351"): drawer.goto(-650,340) drawer.color("black") drawer.write("Correct Password! Press the button to drop the bomb. :)))", font=("Arial", 35, "bold")) armed = True

def four_pressed(): global entered entered = entered + "4" Password() def Two_pressed(): global entered entered = entered + "2" Password() def Three_pressed(): global entered entered = entered + "3" Password() def Five_pressed(): global entered entered = entered + "5" Password() def one_pressed(): global entered entered = entered + "1" Password()

def fire_missle(x,y): if (armed == True): drop() else: print("fail to launch")

------------Events--------------

wn.onkeypress(four_pressed, "4") wn.onkeypress(Two_pressed, "2") wn.onkeypress(Three_pressed, "3") wn.onkeypress(Five_pressed, "5") wn.onkeypress(one_pressed, "1")

benlim10 commented 6 months ago

the code needs to be indented but other than that looks good