Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99240
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!gordon |
|---|---|
| From | John Gordon <gordon@panix.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: anyone tell me why my program will not run? |
| Date | Sun, 22 Nov 2015 16:39:08 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 31 |
| Message-ID | <n2sr3c$50c$1@reader1.panix.com> (permalink) |
| References | <1737402a-2f4d-440a-abd7-6cc500f673e1@googlegroups.com> |
| NNTP-Posting-Host | panix1.panix.com |
| X-Trace | reader1.panix.com 1448210348 5132 166.84.1.1 (22 Nov 2015 16:39:08 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Sun, 22 Nov 2015 16:39:08 +0000 (UTC) |
| User-Agent | nn/6.7.3 |
| Xref | csiph.com comp.lang.python:99240 |
Show key headers only | View raw
In <1737402a-2f4d-440a-abd7-6cc500f673e1@googlegroups.com> Dylan Riley <dylan.riley@hotmail.com> writes:
> heads = int("1")
Why are you taking the int value of a string constant? If you know you
want the value 1, why not just use it directly?
> flips = 100
> headscount = 0
> tailscount = 0
> while flips != 0:
> flips -= 1
This loop has no other effect than to set flips to zero, so why not just
set flips to zero in the first place?
> result = random.randint(heads, tails)
> if result = heads:
> headscount += 1
> else:
> tailscount += 1
Perhaps you meant to have this piece of code indented under the while
loop above?
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
anyone tell me why my program will not run? Dylan Riley <dylan.riley@hotmail.com> - 2015-11-20 19:30 -0800
Re: anyone tell me why my program will not run? Joel Goldstick <joel.goldstick@gmail.com> - 2015-11-20 22:39 -0500
Re: anyone tell me why my program will not run? Chris Angelico <rosuav@gmail.com> - 2015-11-21 16:50 +1100
Re: anyone tell me why my program will not run? Pavel Volkov <sailor@lists.xtsubasa.org> - 2015-11-21 19:57 +0300
Re: anyone tell me why my program will not run? Pavel Volkov <sailor@lists.xtsubasa.org> - 2015-11-21 20:15 +0300
Re: anyone tell me why my program will not run? Larry Hudson <orgnut@yahoo.com> - 2015-11-21 18:44 -0800
Re: anyone tell me why my program will not run? Larry Hudson <orgnut@yahoo.com> - 2015-11-22 13:42 -0800
Re: anyone tell me why my program will not run? John Gordon <gordon@panix.com> - 2015-11-22 16:39 +0000
Re: anyone tell me why my program will not run? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-22 13:09 -0500
csiph-web