Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Peter Otten <__peter__@web.de> Newsgroups: comp.lang.python Subject: Re: error help import random Date: Fri, 20 Nov 2015 18:57:44 +0100 Organization: None Lines: 38 Message-ID: References: <8b0ec311-ab7f-429d-877f-d205ad6008d9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de oj+QPlr63EKYTHvobni1TwaNMpXgnaAox1o7OhV8q1QA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'elif': 0.04; 'subject:help': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'advance': 0.10; 'python': 0.10; 'python.': 0.11; 'subject:error': 0.11; 'input.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:import': 0.16; 'subject:random': 0.16; 'wrote:': 0.16; 'why.': 0.18; 'wrote': 0.23; 'import': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'error': 0.27; 'cookie': 0.29; 'code:': 0.29; 'random': 0.29; 'code': 0.30; 'run': 0.33; 'problem': 0.33; 'could': 0.35; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'display': 0.37; 'thanks': 0.37; 'received:org': 0.37; 'things': 0.38; 'someone': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'your': 0.60; 'identify': 0.61; 'fortune': 0.66; 'here': 0.66; 'riley': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57bd871b.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99175 Dylan Riley 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 > > 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 Make sure that you run your code with Python 3, not Python 2.