end quote help for a newbie

alex23 wuwei23 at gmail.com
Thu Feb 27 23:36:22 EST 2014


On 27/02/2014 8:41 PM, Chris Angelico wrote:
> On Thu, Feb 27, 2014 at 9:30 PM, Peter Clark <artomishka at yahoo.co.uk> wrote:
> # 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.

`startandload` also takes a parameter that doesn't seem to be used.
> 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.

Or perhaps:
 if __name__ == '__main__':
 startandload()


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /