Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:45:56+00:00 2026-06-15T06:45:56+00:00

Alright, I am pretty much a brand new programmer in high school with about

  • 0

Alright, I am pretty much a brand new programmer in high school with about half a years experience(in Python). I am making a basic text game and have run into an error that I have spent hours on but just can’t seem to solve. Sorry if I asked any of this in the wrong way, this is my first question here.

Here is my code:

############################################################################
#               APOCALYPSE GAME - TEXT EDITION                             #         
#               version 0.0.1                                              #
############################################################################
### BEGINNING TEXT. ###
print('Hello, and welcome to my apocalypse game - text edition!')
print()
print('This is my first game, and I would like to make a graphical version')
print('later in my career.')
print()
print('But, for now, here is the text edition of it so you can get a taste')
print('of what is to come.')
print()
print('NOTE: PLEASE ENTER ALL TEXT IN ALL CAPS.')

print('CHARACTER SETUP:')
print()
def gender(): ### ALLOWS USER TO PICK A GENDER FOR THERE CHARACTER.
    womanOrMan = input('Are you a woman or a man(answer WOMAN/MAN)?')
    if womanOrMan == 'MAN':
        print('You are a man.')
        customizationMan()
    elif womanOrMan == 'WOMAN':
        print('You are a woman.')
        customizationWoman()
    else:
        print('Invalid answer. Please try again.')
        gender()

def customizationMan(): ### CHARACTER CUSTOMIZATION FOR MEN. ###
    print('NOTE: IN THIS AREA YOU MAY USE LOWER CAPS. I WILL TELL YOU WHEN TO USE CAPS AGAIN.')
    hair = input('What hairstyle do you have?')
    hairColor = input('What is the color of your hair?')
    eyeColor = input('What is the color of your eyes?')
    noseSize = input('How big is your nose(inches)?')
    beard = input('What is the name of your beard(if none say "NONE")?')
    bodyType = input('What is your body type?')
    race = input('What is your race?')
    clothes = input('What are you wearing?')

    print()
    print('Here is a summary of you: ')
    print()
    print('You have a ' + hair + ' hairstyle, and you the color of it is ' + hairColor + '.')
    print('Your eyes are the color ' + eyeColor + '.')
    print('Your nose is ' + noseSize + ' inches long.')
    if beard == 'NONE':
        print('You are clean shaven.')
    else:
        print('You have a ' + beard + ' beard.')
    print('You have a ' + bodyType + ' body type.')
    print('You are of ' + race + ' background.')
    print('You are wearing ' + clothes + '.')
    characterConfirmation()


def customizationWoman():### CHARACTER CUSTOMIZATION FOR WOMEN.###
    print('NOTE: IN THIS AREA YOU MAY USE LOWER CAPS. I WILL TELL YOU WHEN TO USE CAPS AGAIN.')
    hair = input('What hairstyle do you have?')
    hairColor = input('What is the color of your hair?')
    eyeColor = input('What is the color of your eyes?')
    noseSize = input('How big is your nose(inches)?')
    bodyType = input('What is your body type?')
    race = input('What is your race?')
    clothes = input('What are you wearing?')

    print()
    print('Here is a summary of you: ')
    print()
    print('You have a ' + hair + ' hairstyle, and you the color of it is ' + hairColor + '.')
    print('Your eyes are the color ' + eyeColor + '.')
    print('Your nose is ' + noseSize + ' inches long.')
    print('You have a ' + bodyType + ' body type.')
    print('You are of ' + race + ' background.')
    print('You are wearing ' + clothes + '.')
    characterConfirmation()

def characterConfirmation(): ### CONFIRMS USER WANTS HIS CHARACTER TO LOOK LIKE HIS SELECTIONS FOR SURE. ###
    print('BEGIN TO ANSWER IN ALL CAPS ONCE AGAIN.')
    print('Are you sure this is what you want your character to look like(if you')
    print('enter "YES" you will move on. If you enter "NO" the character creation')
    print('process will restart)?')
    characterRestart = input('Enter "YES" or "NO" now:')
    if characterRestart == "YES":
        attributeSelection()
    elif characterRestart == "NO":
        print('Restarting character creation.')
        gender()
    else:
        print('Invalid answer. Please try again.')
        print()
        print()
        characterConfirmation()


gender()




#####################################################################################################################################
#####################################################################################################################################
#                                                           CHARACTER ATRRIBUTES                                                    #
#####################################################################################################################################
#####################################################################################################################################


def attributeSelection():
    print("Ok. Now it is time to set your character attributes and then you can begin the game")
    print()
    print("You're character attributes are very important. They can determine whether or not")
    print("you survive a certain situation.")
    print("YOU HAVE 25 SKILL POINTS. SPEND THESE ON THE FOUR ATTRIBUTES")
    print("STRENGTH, VITALITY, STEALTH, AND EXPERIENCE.")
    print()
    print()
    print("Strength makes you able to kill enemies faster, and to do tasks that")
    print("you normally coulden't.")
    print()
    print("Vitality makes you able to survive longer in combat situations.")
    print()
    print("Stealth makes you more likely to beable to avoid cobat situations when they are not")
    print("necessary and sneak up on enemies when they are.")
    print()
    print("Experience makes you more likely to be able to survive bad weather conditions,")
    print(" enhances your ability to preserve food, and helps you survive on your own")
    print(" in the wild in general.")
    print()
    print()
    print("TIME TO SELECT YOUR ATTRIBUTES:")
    print()

    balance = 25
    print("Your SP balance is currently 25.")
    strength = input("How much SP do you want to put into strength?")
    balanceAfterStrength = balance - strength
    if balanceAfterStrength == 0:
        print("Your SP balance is now 0.")
        attributeConfirmation()
    elif strength < 0:
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif strength > balance:
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif balanceAfterStrength > 0 and balanceAfterStrength < 26:
        print("Ok. You're balance is now at " + balanceAfterStrength + " skill points.")
    else:
        print("That is an invalid input. Restarting attribute selection.")
        attributeSelection()

    vitality = input("How much SP do you want to put into vitality?(" + balanceAfterStrength + " left!)")
    balanceAfterVitality = balanceAfterStrength - vitality
    if balanceAfterVitality == 0:
        print("You SP balance is now 0.")
        attributeConfirmation()
    elif vitality < 0:
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif vitality > balanceAfterStrength:
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif balanceAfterVitality > 0 and balanceAfterVitality < 26:
        print("Ok. You're balance is now at " + balanceAfterVitality + " skill points.")
    else:
        print("That is an invalid input. Restarting attribute selection.")
        attributeSelection()

    stealth = input("How much SP do you want to put into stealth?(" + balanceAfterVitality + " left!)")
    balanceAfterStealth = balanceAfterVitality - stealth
    if balanceAfterStealth == 0:
        print("Your SP balance is now 0.")
        attributeConfirmation()
    elif stealth < 0 :
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif stealth > balanceAfterVitality:
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif balanceAfterStealth > 0 and balanceAfterStealth < 26:
        print("Ok. You're balance is now at " + balanceAfterStealth + " skill points.")
    else:
        print("That is an invalid input. Restarting attribute selection.")
        attributeSelection()

    experience = input("How much SP do you want to put into experience?(" + balanceAfterStealth + " left!")
    balanceAfterExperience = balanceAfterStealth - experience
    if balanceAfterExperience == 0:
        print("Your SP balance is now 0.")
        attributeConfirmation()
    elif experience < 0:
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif experience > balanceAfterStealth:
        print("That is an invalid input. Restarting attribute selection. Keep an eye on your balance this time!")
        attributeSelection()
    elif balanceAfterExperience > 0 and balanceAfterStealth < 26:
        print("Oops! You did not spend all of your skill points. Restarting attribute selection.")
        print(" remember to spend all of them this time!")
        attributeSelection()
    else:
        print("That is an invalid input. Restarting attribute selection.")
        attributeSelection()

def attributeConfirmation():
    print("ATTRIBUTE CONFIRMATION TEST SUCCESS!")

The problem is, when I run the code in the shell, this is what happens:

Hello, and welcome to my apocalypse game - text edition!

This is my first game, and I would like to make a graphical version
later in my career.

But, for now, here is the text edition of it so you can get a taste
of what is to come.

NOTE: PLEASE ENTER ALL TEXT IN ALL CAPS.
CHARACTER SETUP:

Are you a woman or a man(answer WOMAN/MAN)?MAN
You are a man.
NOTE: IN THIS AREA YOU MAY USE LOWER CAPS. I WILL TELL YOU WHEN TO USE CAPS AGAIN.
What hairstyle do you have?UGLY MULLET
What is the color of your hair?BROWN
What is the color of your eyes?BLUE
How big is your nose(inches)?5
What is the name of your beard(if none say "NONE")?NONE
What is your body type?ATHLETIC
What is your race?WHITE
What are you wearing?JEANS AND A TSHIRT

Here is a summary of you:

You have a UGLY MULLET hairstyle, and you the color of it is BROWN.
Your eyes are the color BLUE.
Your nose is 5 inches long.
You are clean shaven.
You have a ATHLETIC body type.
You are of WHITE background.
You are wearing JEANS AND A TSHIRT.
BEGIN TO ANSWER IN ALL CAPS ONCE AGAIN.
Are you sure this is what you want your character to look like(if you
enter "YES" you will move on. If you enter "NO" the character creation
process will restart)?
Enter "YES" or "NO" now:YES
Traceback (most recent call last):
    File "C:/Python32/APOCALYPSE GAME LIBRARY/apocalypseGame.py", line 96, in <module>
        gender()
    File "C:/Python32/APOCALYPSE GAME LIBRARY/apocalypseGame.py", line 22, in gender
        customizationMan()
    File "C:/Python32/APOCALYPSE GAME LIBRARY/apocalypseGame.py", line 54, in customizationMan
        characterConfirmation()
    File "C:/Python32/APOCALYPSE GAME LIBRARY/apocalypseGame.py", line 85, in characterConfirmation
        attributeSelection()
NameError: global name 'attributeSelection' is not defined

I have no idea why I am getting this error. I think that it is telling me that I did not define the function attributeSelection, but I obviously did. I have also checked all my spelling… so i am stumped. Does anyone know how I could fix this? Thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:45:57+00:00Added an answer on June 15, 2026 at 6:45 am

    Try moving the lone gender() line right at the bottom of the code.

    When it is being called, the needed methods such as attributeSelection are not defined yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright I'm pretty new to programming and stuff and I'm now trying to code
Alright so I'm pretty new to this rails stuff so please bear with me...
Alright, I'm new to threading, so my question might be pretty dumb. But what
Alright, i seem to be asking a lot today but i'm pretty much stumped
Alright so pretty basic, here are the pieces of code I have, basically it's
Alright I don't see why this isnt working. It seems pretty simple. Here is
Alright, so I got this code for gluLookAt: lookAt = new Vector3f(-player.pos.x, -player.pos.y, -player.pos.z);
Alright, so I think I'm pretty close to having what I need, but I'm
Alright, I thought I understood generics pretty well, but for some reason I can't
Alright, this is probably gonna be a pretty simple question to answer. I haven't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.