[Tutor] (no subject)

Jon Kolbe jonnorkol at yahoo.com
Sat Sep 4 17:40:26 CEST 2004


I'm new to python, and I'm having some trouble. I'm trying to write a program so people can make a character for a Risus game. Since the cliches (skills) of the character have to be user-defined, I can't make a list. I've gotten to where the user has to insert the name of the cliche, but I've ran into this error
 
Traceback (most recent call last):
  File "<pyshell#38>", line 1, in -toplevel-
    risus()
  File "<pyshell#37>", line 15, in risus
    reply = input()
  File "<string>", line 0, in -toplevel-
NameError: name 'cook' is not defined
 
Here's my program
 
#Risus Character Generator
def risus():
 cliches = {}
 player = {}
 player['Name'] = raw_input("What is the Character's name? ")
 dice = input("How many dice will your character have? ")
 player['Title'] = raw_input("What is the Character's title? ")
 while dice > 0:
  print "Do you want to add a cliche? "
  print "1 Yes "
  print "2 No "
  reply = input() 
  if reply == 1:
   print "What is the name of the cliche? "
   reply = input()
   cliches = { 'cliche': "reply" }
   print "How many dice? "
   power = input()
   dice = dice-power
   cliches = { 'cliche': "power" }
   player[cliches] = power
  else:
   dice = 0
 print "You're done!"
 print character
 
If any one can give me a hint on how to add user-input to a list, thanks in advance
Jon

		
---------------------------------
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040904/a975140f/attachment.html


More information about the Tutor mailing list