error help import random
Ian Kelly
ian.g.kelly at gmail.com
Fri Nov 20 13:10:49 EST 2015
On Fri, Nov 20, 2015 at 10:57 AM, Peter Otten <__peter__ at web.de> wrote:
> Dylan Riley wrote:
>
>> input("\nPress enter to see your fortune")
>
> Make sure that you run your code with Python 3, not Python 2.
Or if you must use Python 2, use raw_input() instead of input().
>> fortune = random.randrange(6) + 1
Also, you have an off-by-one error here. randrange(6) will give you an
integer between 0 and 5, inclusive (a total of 6 possible values).
Adding 1 will then result in an integer between 1 and 6, inclusive,
but you don't have a case for a value of 6.
More information about the Python-list
mailing list