Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!news2.euro.net!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.043 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'else:': 0.03; '21,': 0.07; 'function,': 0.07; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'bind': 0.16; 'blocks': 0.16; 'innermost': 0.16; 'subject:when': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'code.': 0.20; 'math': 0.20; 'fairly': 0.21; 'meant': 0.21; 'cc:2**0': 0.23; 'statement': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'functions.': 0.27; 'to?': 0.27; 'chris': 0.28; 'indentation': 0.29; "i'm": 0.29; 'function': 0.30; 'running': 0.32; 'goes': 0.33; 'says': 0.33; 'function.': 0.33; 'up!': 0.33; 'program,': 0.34; 'received:google.com': 0.34; 'pm,': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'be.': 0.36; 'too': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'sure': 0.38; 'your': 0.60; 'lost': 0.60; 'easy': 0.60; 'side': 0.61; 'back': 0.62; 'is.': 0.62; 'personal': 0.62; 'here': 0.65; '20,': 0.65; 'honest': 0.75; "'if": 0.84; '2013': 0.84; 'unifying': 0.84; 'yet?': 0.84; 'eli': 0.93; 'taught': 0.97 X-Received: by 10.50.217.201 with SMTP id pa9mr2408958igc.17.1358744129398; Sun, 20 Jan 2013 20:55:29 -0800 (PST) Newsgroups: comp.lang.python Date: Sun, 20 Jan 2013 20:55:29 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.62.139.168; posting-account=T0Q4ngoAAADFqe_JPINLNp5NgW2XDzan References: <2cc6791f-ba56-406c-a5b0-b23023caf4bb@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 75.62.139.168 MIME-Version: 1.0 Subject: Re: Else statement executing when it shouldnt From: eli m To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 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: , Message-ID: Lines: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358744754 news.xs4all.nl 6925 [2001:888:2000:d::a6]:45107 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37150 On Sunday, January 20, 2013 8:52:12 PM UTC-8, Chris Angelico wrote: > On Mon, Jan 21, 2013 at 3:40 PM, eli m wrote: > > > an else statement is running when it shouldnt be. It is on the last line. Whenever i am in the math or game function, when i type in main, it goes back to the start of the program, but it also says not a valid function. I am stumped! > > > > Check your indentation levels. I see a few things here that look odd: > > > > > if function == "help": > > > while helpfunc == 0: > > > if helpmain == "main": > > > else: > > > > What is the else meant to bind to? The innermost if? The 'if function > > == "help"'? It's currently binding to the while. > > > > Recommendation: Break this up! Your main loop is huge! It's way too > > easy to get lost in it. And while you're at it, consider unifying some > > of the similar blocks of code. The solution to both issues is simple: > > Use functions. Have you been taught about them yet? > > > > Also, side tip: Be honest about homework. I'm fairly sure that's what > > this is. :) > > > > ChrisA Its not homework. It is a personal project.