Hi, I'm a beginner and I've reached a roadblock. I'm trying to create a simple guessing game program just to practice creating loops, however it is not working out as planned.
print ("Lets play a game") import random # Generate random number from 1-10 rand_value = random.randint(1,10) guess = input("Guess a number from 1-10 ") if guess == rand_value: print ("Congratulations! You guessed it!") while guess != rand_value: input ("try again") else: print ("Sorry, you're wrong.") input ("\n\nBetter luck next time. Press the enter key to exit.") The goal is for the program to keep running until someone successfully guesses the right number, however I think I've accidentally created an infinite loop. Any help will be greatly appreciated. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor