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


Groups > comp.lang.python > #67135

Re: end quote help for a newbie

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'interpreter': 0.05; 'subject:help': 0.08; 'cursor': 0.09; 'occasionally': 0.09; 'restart': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'accepting': 0.14; 'windows': 0.15; '.py': 0.16; 'clark': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'once.': 0.16; 'parentheses': 0.16; 'str()': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'passing': 0.19; 'thu,': 0.19; 'seems': 0.21; 'feb': 0.22; 'appears': 0.22; 'input': 0.22; 'cc:addr:python.org': 0.22; 'load': 0.23; 'string,': 0.24; 'file.': 0.24; "haven't": 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'long,': 0.26; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '(which': 0.31; 'easier': 0.31; 'subject:end': 0.31; 'file': 0.32; 'run': 0.32; 'text': 0.33; 'open': 0.33; 'running': 0.33; 'beginning': 0.33; 'screen': 0.34; 'problem': 0.35; 'december': 0.35; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'done': 0.36; 'doing': 0.36; "i'll": 0.36; 'hi,': 0.36; 'pm,': 0.38; 'anything': 0.39; 'does': 0.39; 'called': 0.40; 'skip:x 10': 0.40; 'simple': 0.61; 'places': 0.64; 'close': 0.67; 'response.': 0.68; 'anything.': 0.68; 'click': 0.77; 'introduce': 0.78; 'future,': 0.83; "it'd": 0.84; 'opens': 0.91; 'to:none': 0.92; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=LdngpUlyJmt7ihZl+DG1yLoBqXBSyqqjoFqLrFrJtXc=; b=jj/2Bcb+UBW8OEVRyAlclxSjiXVSVk3DqggwzbFivFrw2v/vQc2S5ymlI57s5HwiDM NpXMpb3SjPTWae3MLVH8q5Uck85YjHPi7HBZlA7K2CqtDV2i4m04Bt2V20wLAETvTckj IVjogNwqIL452iDmICtIPmREN+SvrymwWuqhRakP/lPryCPr0hyux5dvZKo4Mwiy2Ksp Skh4cj02lJNoEGy/d9uJKjveZw1PI5Sj5ryi3vObiYTD1jdycvAFc7wLrYjVRVIh1JFj nzxCvvStsMUgDydCQzDpOJrxzM3c3GuEEIP94vte/WeIIqXBGmWxGGCEUuQfdZAqmIub vafA==
MIME-Version 1.0
X-Received by 10.66.27.202 with SMTP id v10mr14327260pag.127.1393497713998; Thu, 27 Feb 2014 02:41:53 -0800 (PST)
In-Reply-To <1393497041.37213.YahooMailNeo@web133105.mail.ir2.yahoo.com>
References <1391088376.73476.YahooMailNeo@web133103.mail.ir2.yahoo.com> <CAKJDb-PpPiFnG7=jmrUGnXZPqkdHWHFCxe9N6Dct5gbrQT5sdQ@mail.gmail.com> <1391093552.89290.YahooMailNeo@web133104.mail.ir2.yahoo.com> <CAKJDb-Nqo_+f-m3iMBexkCFeF60yyKLgqeFH7N6762_z2zoa5Q@mail.gmail.com> <1391110020.83595.YahooMailNeo@web133106.mail.ir2.yahoo.com> <1393497041.37213.YahooMailNeo@web133105.mail.ir2.yahoo.com>
Date Thu, 27 Feb 2014 21:41:53 +1100
Subject Re: end quote help for a newbie
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.7418.1393497723.18130.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1393497723 news.xs4all.nl 2836 [2001:888:2000:d::a6]:44336
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67135

Show key headers only | View raw


On Thu, Feb 27, 2014 at 9:30 PM, Peter Clark <artomishka@yahoo.co.uk> wrote:
> Hi, I have just started trying to use python version 3, under windows XP, I
> have got a simple script (attached) to run as I want in Interpreter mode.
> It is saved as a .py file. If I double click on the file the python screen
> opens and appears to be waiting for input but the cursor just sits there
> without doing anything but blink. I haven't found any .py program which does
> anything except open and close the python window, or occasionally accepting
> input with no response.

In future, it'd be easier for us if you include the text inline. It's
not particularly long, so I'll just do that for you here.

# Dragons and dungeons, based on CP/M program messages from ca. 1966
# This version designed and produced by peter clark beginning in December 2013
def startandload(n):    # introduce program and allow messages to be
loaded/amended
    x = str(input("Welcome Adventurer, what is your name?"))
    if x==('load'):
        y = str(input("messages, places or things?"))
        if y in("messages", "places","things"):
            print("OK")
        else: print("Wrong")
    if x==('restart'):
        y = str(input("game reference"))
        if y in("messages", "places","things"):
            print("*** to be done - load and restart game ***")
        else: print("Wrong")

while True:
    startandload


The problem is right at the end: you don't actually call the function.
You always need parentheses to call a function. I'm also a bit
confused as to your reason for running a function called
"startandload" (which seems to be initialization) in an infinite loop;
you possibly just want to call it once.

Note that input() already returns a string, so passing it through
str() doesn't do anything.

ChrisA

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


Thread

Re: end quote help for a newbie Chris Angelico <rosuav@gmail.com> - 2014-02-27 21:41 +1100
  Re: end quote help for a newbie alex23 <wuwei23@gmail.com> - 2014-02-28 14:36 +1000

csiph-web