Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #67135
| References | (1 earlier) <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 | 2014-02-27 21:41 +1100 |
| Subject | Re: end quote help for a newbie |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7418.1393497723.18130.python-list@python.org> (permalink) |
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 | Next — Next in thread | Find similar | Unroll 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