5. Repetitions¶

38
# If the number was not guessed, repeat the function after
from browser import document as doc
from browser import html
from browser import timer
print("Welcome!")
number = 0
doc <= html.DIV(id="div_game")
# Create the button to play
doc["div_game"] <= html.BUTTON("Play", id="btn_play")
# Define what the button will do when pressed
def guess():
global number
number = int(input("Guess the number: "))
if number == 42:
print("You won!")
else:
if number > 42:
print("High")
else:
print("Low")
Activity: 5.1 ActiveCode (ac_l30_5_en)

5.1. Users Still Dislike It¶

You have attempted 1 of 2 activities on this page