Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99218

Re: anyone tell me why my program will not run?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Pavel Volkov <sailor@lists.xtsubasa.org>
Newsgroups comp.lang.python
Subject Re: anyone tell me why my program will not run?
Date Sat, 21 Nov 2015 20:15:05 +0300
Lines 25
Message-ID <mailman.43.1448126112.2291.python-list@python.org> (permalink)
References <1737402a-2f4d-440a-abd7-6cc500f673e1@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de T21OJFTlBua4xUfvibnONgRjfRYAdJV40U0Mdmj9w+zQ==
Return-Path <sailor@lists.xtsubasa.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'else:': 0.03; 'notes:': 0.09; 'subject:why': 0.09; 'way:': 0.09; 'subject:not': 0.11; 'result.': 0.15; 'beginning.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:program': 0.16; 'subject:run': 0.16; 'wrote:': 0.16; '2015': 0.20; 'skip:\xd1 10': 0.22; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'gives': 0.35; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'why': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; '8bit%:93': 0.60; 'strange': 0.63; 'more': 0.63; 'subjectcharset:iso-8859-1': 0.65; 'riley': 0.84; 'subject:tell': 0.84; 'received:185': 0.91
X-PV-Sent sailor@lists.xtsubasa.org
User-Agent Trojita/0.5; Qt/5.5.1; xcb; Linux; Gentoo Base System release 2.2
In-Reply-To <1737402a-2f4d-440a-abd7-6cc500f673e1@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:99218

Show key headers only | View raw


On суббота, 21 ноября 2015 г. 6:30:02 MSK, Dylan Riley wrote:

Also some more notes:

> heads = int("1")
> tails = int("2")

Why use this strange initialization? The usual way:
heads = 1
tails = 2
gives the same result.

> while flips != 0:
>     flips -= 1

There's no need to use while and flips variable:

for _ in range(100):
    if random.randint(heads, tails) == heads:
        headscount += 1
    else:
        tailscount += 1
  
Also, it's good to put import at the beginning.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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