I just learned the guess a number game from a book called Automate the Boring Stuff With Python (code below). I got it to work using a terminal but I'm wondering how I could set it up to render on an html page. Ideally, I would like to use Flask and just render the html pages locally for now.
import random
correct = random.randint(1,20)
print('I am thinking of a number between 1 and 20.')
for guessesTaken in range(1,6):
print('Take a guess.')
guess = int(input())
if guess < correct:
print('Your number is too low')
elif guess > correct:
print('Your number is too high')
else:
break
if guess == correct:
print('Good work! You got the number in '+ str(guessesTaken)+ ' guesses')
else:
print('Nope. The number I was thinking of was ' + str(correct))