Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37141
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.datemas.de!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.052 |
| X-Spam-Evidence | '*H*': 0.90; '*S*': 0.00; 'else:': 0.03; '21,': 0.07; 'function,': 0.07; 'bind': 0.16; 'blocks': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 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; 'statement': 0.23; 'header:In-Reply-To:1': 0.25; 'functions.': 0.27; 'to?': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 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; 'to:addr:python-list': 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; 'to:addr:python.org': 0.39; 'your': 0.60; 'lost': 0.60; 'easy': 0.60; 'side': 0.61; 'back': 0.62; 'is.': 0.62; 'here': 0.65; 'honest': 0.75; "'if": 0.84; '2013': 0.84; 'unifying': 0.84; 'yet?': 0.84; 'eli': 0.93; 'taught': 0.97 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=FXJlFJleRbfCkQX4eLtWicWkhOEf3s9QoS1fpmT+8XY=; b=uo+v/2jpb+rhEXg7GRML0lzC1g4JKHU4rZTtk/7OM9u4Fo1qI9mqZgYcvGhm9KR3dg P4ghJwDFsAaInRHBl/FUAg5r4kj5bD2knziV7c0TrD6QTNXhazE6g3SHfPnVCY8OYliA i90kJSCqQgjWxQBj6K8A64R2SCLlZfkZvtRiTEoO/pubdP3RR+gpYly1BWXFVl8JkIYU Nm8gU+bQptYIr4PHRLbS0ENGaOFAOm/A6A39NzatZBkdGrK+o07OSs04V+LG3dh1lc08 bsC9Uvby+bM00R4LBMyV7cRsqUVvq2Rkj7SnYJQy0NAU0v5sBD0kTl1kzbET6EENa1r9 5u0Q== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.219.77 with SMTP id ht13mr3827956vcb.66.1358743932325; Sun, 20 Jan 2013 20:52:12 -0800 (PST) |
| In-Reply-To | <2cc6791f-ba56-406c-a5b0-b23023caf4bb@googlegroups.com> |
| References | <2cc6791f-ba56-406c-a5b0-b23023caf4bb@googlegroups.com> |
| Date | Mon, 21 Jan 2013 15:52:12 +1100 |
| Subject | Re: Else statement executing when it shouldnt |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.718.1358743935.2939.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358743935 news.xs4all.nl 6843 [2001:888:2000:d::a6]:58851 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37141 |
Show key headers only | View raw
On Mon, Jan 21, 2013 at 3:40 PM, eli m <techgeek201@gmail.com> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:40 -0800
Re: Else statement executing when it shouldnt Roy Smith <roy@panix.com> - 2013-01-20 23:47 -0500
Re: Else statement executing when it shouldnt Chris Angelico <rosuav@gmail.com> - 2013-01-21 15:52 +1100
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:55 -0800
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:55 -0800
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:54 -0800
Re: Else statement executing when it shouldnt alex23 <wuwei23@gmail.com> - 2013-01-20 22:00 -0800
Re: Else statement executing when it shouldnt Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-21 08:04 +0000
Re: Else statement executing when it shouldnt René Klačan <rene.klacan@gmail.com> - 2013-01-21 05:54 +0100
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:57 -0800
Re: Else statement executing when it shouldnt René Klačan <rene.klacan@gmail.com> - 2013-01-21 06:06 +0100
Re: Else statement executing when it shouldnt René Klačan <rene.klacan@gmail.com> - 2013-01-21 06:07 +0100
Re: Else statement executing when it shouldnt Thomas Boell <tboell@domain.invalid> - 2013-01-22 16:39 +0100
Re: Else statement executing when it shouldnt Chris Angelico <rosuav@gmail.com> - 2013-01-23 02:42 +1100
Re: Else statement executing when it shouldnt Thomas Boell <tboell@domain.invalid> - 2013-01-22 16:48 +0100
Re: Else statement executing when it shouldnt Chris Angelico <rosuav@gmail.com> - 2013-01-23 03:07 +1100
Re: Else statement executing when it shouldnt Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:22 +0000
Re: Else statement executing when it shouldnt René Klačan <rene.klacan@gmail.com> - 2013-01-23 01:34 +0100
Re: Else statement executing when it shouldnt Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-22 22:11 -0500
Re: Else statement executing when it shouldnt alex23 <wuwei23@gmail.com> - 2013-01-22 17:28 -0800
Re: Else statement executing when it shouldnt Thomas Boell <tboell@domain.invalid> - 2013-01-23 12:22 +0100
Re: Else statement executing when it shouldnt Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-01-23 15:35 +0200
Re: Else statement executing when it shouldnt Jerry Hill <malaclypse2@gmail.com> - 2013-01-23 09:53 -0500
Re: Else statement executing when it shouldnt Frank Millman <frank@chagford.com> - 2013-01-25 10:15 +0200
Re: Else statement executing when it shouldnt Duncan Booth <duncan.booth@invalid.invalid> - 2013-01-22 15:48 +0000
Re: Else statement executing when it shouldnt Duncan Booth <duncan.booth@invalid.invalid> - 2013-01-22 15:52 +0000
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:57 -0800
Re: Else statement executing when it shouldnt Mitya Sirenef <msirenef@lightbird.net> - 2013-01-20 23:57 -0500
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:59 -0800
Re: Else statement executing when it shouldnt Mitya Sirenef <msirenef@lightbird.net> - 2013-01-21 01:09 -0500
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-20 20:59 -0800
Re: Else statement executing when it shouldnt alex23 <wuwei23@gmail.com> - 2013-01-20 21:46 -0800
Re: Else statement executing when it shouldnt alex23 <wuwei23@gmail.com> - 2013-01-20 21:56 -0800
Re: Else statement executing when it shouldnt eli m <techgeek201@gmail.com> - 2013-01-21 07:37 -0800
Re: Else statement executing when it shouldnt Chris Angelico <rosuav@gmail.com> - 2013-01-22 05:44 +1100
csiph-web