Red Kelly
March 6th, 2011, 05:57 AM
hi I'm trying to learn python and after typing this up the same as what is in the book I still get an error could you tell me what is wrong with it?
"""
chargen.py
Problem: Generate a description for a fantasy role-playing character.
Target Users: Me and my friends
Target System: GNU/Linux
Interface: Command-line
Functional Requirements: Print out the character sheet
User must be able to input the character's
name, description, gender and race
Testing: Simple run test
Maintainer: maintainer@website.com
"""
__version__ = 0.1
Name = ""
Desc = ""
Gender = ""
Race = ""
# Prompt user for user-defined information
Name = input("What is your Name? ")
Desc = input('Describe yourself: ')
Gender = input('What Gender are you? (male / female): ')
Race = input('What fantasy Race are you? - (pixie / Vulcan / Gelfling / Troll): ')
# Output the character sheet
fancy = "-----------------------------------"
print("\n", fancy)
print("\t", Name)
print("\t", Race, Gender)
print("\t", Desc)
Print(fancy, "\n")
and this is the error I get after entering my name
What is your Name? Red
Traceback (most recent call last):
File "fantacy_game.py", line 22, in <module>
Name = input("What is your Name? ")
File "<string>", line 1, in <module>
NameError: name 'Red' is not defined
"""
chargen.py
Problem: Generate a description for a fantasy role-playing character.
Target Users: Me and my friends
Target System: GNU/Linux
Interface: Command-line
Functional Requirements: Print out the character sheet
User must be able to input the character's
name, description, gender and race
Testing: Simple run test
Maintainer: maintainer@website.com
"""
__version__ = 0.1
Name = ""
Desc = ""
Gender = ""
Race = ""
# Prompt user for user-defined information
Name = input("What is your Name? ")
Desc = input('Describe yourself: ')
Gender = input('What Gender are you? (male / female): ')
Race = input('What fantasy Race are you? - (pixie / Vulcan / Gelfling / Troll): ')
# Output the character sheet
fancy = "-----------------------------------"
print("\n", fancy)
print("\t", Name)
print("\t", Race, Gender)
print("\t", Desc)
Print(fancy, "\n")
and this is the error I get after entering my name
What is your Name? Red
Traceback (most recent call last):
File "fantacy_game.py", line 22, in <module>
Name = input("What is your Name? ")
File "<string>", line 1, in <module>
NameError: name 'Red' is not defined