error help import random

Seymore4Head Seymore4Head at Hotmail.invalid
Fri Nov 20 18:05:09 EST 2015


On Fri, 20 Nov 2015 09:22:10 -0800 (PST), Dylan Riley
<dylan.riley at hotmail.com> wrote:

>This is my fortune cookie program i wrote in python.
>the problem is it will not run past the first line of input.
>could someone please identify the error and explain to me why.
>here is the code:
>
>#the program silulates a fortune cookie
>#the program should display one of five unique fortunes, at randon, each time its run
>
>import random
>
A problem I used to have is that if you have a file called random.py
in the folder when you try to import random, it caused an error.

>print("  \\ \\ \\ \\ DYLANS FORTUNE COOKIE \\ \\ \\ ")
>print("\n\n\tGood things come to those who wait")
>input("\nPress enter to see your fortune")
>
>fortune = random.randrange(6) + 1
>print(fortune)
>if fortune == 1:
>    print("happy")
>elif fortune == 2:
>    print("horny")
>elif fortune == 3:
>    print("messy")
>elif fortune == 4:
>    print("sad")
>elif fortune == 5:
>    print("lool")
>
>print("hope ypu enjoyed your fortune being told")
>input("\nPress enter to exit")
>
>
>many thanks in advance



More information about the Python-list mailing list