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 8644975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:25:51+00:00 2026-06-12T12:25:51+00:00

I know it’s a heavily discussed topic, I know there are tons of threads

  • 0

I know it’s a heavily discussed topic, I know there are tons of threads out there about it (I’ve read them all), but I still Just Don’t Get It.

Undefined variables (both local and global) are my biggest problem in Python and I have no idea what I’m doing when trying to fix them. I’ll go through and add an x = 0 or a var = func(var) some where and some times it works and sometimes it doesn’t. It’s incredibly frustrating and I really need some help. I’ve asked my teacher but it usually takes her a while to get back to me and I’d like to get this thing fixed.

Here’s what I’m working on: http://pastebin.com/KTuh7D2p (This is for school.)

Can someone please explain variable thing to me?

I keep getting errors like this:

Traceback (most recent call last):
  File "Project1-v2.py", line 144, in <module>
    main()
  File "Project1-v2.py", line 12, in main
    itemsSave = tagYell(items, itemsSale, itemsSave)
UnboundLocalError: local variable 'itemsSave' referenced before assignment
  • 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-12T12:25:52+00:00Added an answer on June 12, 2026 at 12:25 pm

    In this particular case, I would guess that it is because you are trying to use itemSave to define itself. This is equivalent to saying something like:

    x = 5 + x
    

    the very first time you define x.

    You need to give some context as to what itemSave is before you can try and use its value.

    For example, this program:

    myNum = 5
    x = float(myNum+x)
    print x
    

    Would give me an error message of:

    x = float(myNum+x)
    NameError: name 'x' is not defined
    

    This however, would work fine, and print “15”:

    myNum = 5
    x = 10
    x = float(myNum+x)
    print x
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there's something fishy about the malloc part, but I'm having trouble
I know very little about Agile but I wonder if there is any difference
I know there are similar questions already on SO but none of them seem
I know that this has been discussed thousand times but I still cannot figure
I know that there has been one question about this but it is not
Know this might be rather basic, but I been trying to figure out how
I know you can not set a key value dynamically, but what about the
I know that this sort of question has been asked here before, but still
I know this has been discussed yet I wanted to ask about the current
I know theres a lot of posts about redirects but this is a little

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.