I'm pretty new here and looking for some more programming knowledge. I'm sorry if this question is already answered or if it might be stupid.
I'm trying to build a simple programming game. But the while function is not letting me. I guess it's something really simple for you guys, so please help!
I want to create a looping game for guessing the right number.
I've tried looking on google for different codes but no luck so far.
#This is a guess the number game.
import random
print('Hello, what is your name?')
name = input()
print('Well, ' + name + ', I am thinking of a number between 1 and 20.')
secretNumber = random.randint(1, 20)
print('Take a guess......')
guess = int(input()
while guess != secretNumber:
print('Take a guess.')
if guess == secretNumber:
print('Good job, ' + name + '! You guessed my number in ' + str(guessesTaken) + ' guesses!')
The problem seems to be in the "while function", I want it to loop non stop until someone guesses the number.