Hello All, this is basically my first tackle on programming in itself. I chose python, because it seems pretty straight-forward for now. I'm on HtRegz's 2nd tutorial now, and am feeling like i'm understanding it and progressing just fine, but the while loop is just a little difficult for me to understand at first, so here is where i might need a little help
Now I feel like i answered my own questionCode:from random import * answer = randint(1,25) # I'm aware this assigns a random number of 1-25 to the var 'answer' guess = 0 counter = 0 # I'm having a hard time figuring out how the counter works print "Welcome to the Number Guessing Game" while guess != answer : guess = input("Please Guess a Number between 1 and 25: ") if guess < answer : print "To low." elif guess > answer : print "To high." counter = counter + 1 print "Congrats you guessed the correct number (",answer,") in",counter,"tries." # I know they are are random numbers, but if you guess the right number, the counter goes up 1, but i don't understand why it goes up to 1, because there wasn't a statement anywhere that said they were equal to each other.![]()
little help here ...




Reply With Quote