[Tutor] Why doesn't it choose a new number each time?

Rikard Bosnjakovic rikard.bosnjakovic at gmail.com
Wed Feb 14 08:44:34 CET 2007

On 2/14/07, Nathan Pinno <falcon3166 at hotmail.com> wrote:

>  I wrote a rock, paper, scissors game and every time you play without
> exiting, it chooses the same number. How can I fix this problem? The
> relative code is below:
>         compchoice = choice(range(3))

>>> range(3)
[0, 1, 2]

You either have to change your if-case ranges from 1-3 to 0-2, or
simply add one to the "compchoice" variable.

- Rikard.

More information about the Tutor mailing list