Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Neil Cerutti Newsgroups: comp.lang.python Subject: Re: First python program, syntax error in while loop Date: 3 May 2013 20:30:23 GMT Organization: Norwich University Lines: 29 Message-ID: References: <24c5856e-a30a-41bd-aa4a-0e594734e1f8@googlegroups.com> <163bd508-f225-4b4d-8173-1e070c5d5aad@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net G5Yd5aUOT9327KsQW3138gLHWYMuAN8lPOKs1k45Vl2bW4Q4Dx Cancel-Lock: sha1:ePlArZK16dIh9gcSBS8mPz8v7hI= User-Agent: slrn/0.9.9p1/mm/ao (Win32) Xref: csiph.com comp.lang.python:44687 On 2013-05-03, ryankoch38@gmail.com wrote: > Thank you! It's 100% functional now, here's the final project: > > title = "Guess my number game:" > print title.title() > raw_input("Press any key to continue..") > > import random > > number = random.randrange(99) + 1 > tries = 0 > guess = int(raw_input("Guess my number! Secret - It is between 1 and 100 :")) > > while (guess != number) and (tries <5): > [...] > > if (tries <5): > print "\nCongratulations! You guessed my number in", tries, "tries" > else: > print "\nSorry, you took too many tries to guess my number!" > raw_input("\n\n Press any key to exit..") > > ## Maybe now I can work on a useful project Not quite yet. Players who guess correctly on the fifth try don't get credit. -- Neil Cerutti