Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; 'subject:help': 0.08; 'cc:addr:python-list': 0.11; '"if"': 0.16; '-tkc': 0.16; 'comparison.': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'value.': 0.19; 'input': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'leave': 0.29; 'statement': 0.30; 'subject:please': 0.30; 'charset:us-ascii': 0.36; 'subject:?': 0.36; "you're": 0.61; 'email addr:gmail.com': 0.63; 'to:addr:gmail.com': 0.65; 'lack': 0.78; 'fare': 0.84; 'received:50.22': 0.84 Date: Tue, 12 Nov 2013 16:59:24 -0600 From: Tim Chase To: lrwarren94@gmail.com Subject: Re: Some python newb help please? In-Reply-To: <22894a10-1ffd-4671-94f4-962dfb56e4fd@googlegroups.com> References: <22894a10-1ffd-4671-94f4-962dfb56e4fd@googlegroups.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.com Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384297075 news.xs4all.nl 15877 [2001:888:2000:d::a6]:47146 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59247 On 2013-11-12 14:27, lrwarren94@gmail.com wrote: > if int(raw_input()) == 1: > print "Moving north" > y = y + 1 > elif int(raw_input()) == 2: > print "Moving east" > x = x + 1 > elif int(raw_input()) == 3: > print "Moving south" > y = y - 1 > elif int(raw_input()) == 4: > print "Moving west" > x = x - 1 > elif int(raw_input()) == 5: > print "Dost thou leave so soon? Fare thee well!" > quitCommand = 5 > else: > print "I find your lack of reading comprehension skills > disturbing." Note that you're asking for input with each comparison. Best to get the input once and store it in a variable before the "if" statement and then do the comparisons against the same value. -tkc