Your variable assignment for Random_Number is outside of your while loop. Therefore its value never changes. Put it inside the while loop just before the print statement and I think you will get what you
That was it! Thank you, you made my day, Bob :-) On Mon, May 20, 2013 at 6:37 PM, boB Stepp <robertvst...@gmail.com> wrote: > > On Mon, May 20, 2013 at 11:31 AM, Rafael Knuth <rafael.kn...@gmail.com> wrote: > > > > Hello, > > > > I wrote a simple program, and I was expecting that I would get 100 different random numbers. Instead, I am getting 100 times exactly the same random number. Can anyone advise how I should alter my program? > > > > Thank you! > > > > All the best, > > > > Rafael > > PS. I am using Python 3.3.0 > > > > print (""" > > > > This game will return 100 random numbers between 1 and 100. > > > > """) > > > > import random > > > > Count = 0 > > > > Random_Number = random.randint(1, 100) > > > > while Count <= 100: > > print (Random_Number) > > > > Count = Count + 1 > > > Your variable assignment for Random_Number is outside of your while > loop. Therefore its value never changes. Put it inside the while loop > just before the print statement and I think you will get what you > wanted. > > HTH, > boB > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor