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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:48:34+00:00 2026-06-16T00:48:34+00:00

For some reason when I tap c, it gives me ‘courses’ is not defined.

  • 0

For some reason when I tap c, it gives me ‘courses’ is not defined.

Please enter a menu choice…
[c]ourses, [i]nstructors, [t]imes: c
Traceback (most recent call last):

line 15, in main
print(create_info(courses))
NameError: global name ‘courses’ is not defined

def main():
    courseInfo = create_info()

    print('Please enter a menu choice...')
    choice = input('[c]ourses, [i]nstructors, [t]imes: ').upper()

    if choice == 'C':
        print(create_info(courses))


def create_info():
    courses = {'CS101':'3004', 'CS102':'4501', 'CS103':'6755', 'NT110':'1244',
               'CM241':'1411'}
    instructors = {'CS101':'Haynes', 'CS102':'Alvarado', 'CS103':'Rich',
                   'NT110':'Burke', 'CM241':'Lee'}
    times = {'CS101':'8:00 a.m.', 'CS102':'9:00 a.m.', 'CS103':'10:00 a.m.',
             'NT110':'11:00 a.m.', 'CM241':'1:00 p.m.'}

    return courses, instructors, times

main()
  • 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-16T00:48:35+00:00Added an answer on June 16, 2026 at 12:48 am

    Change main() like so:

    def main():
        courses, instructors, times = create_info()    # <<<
    
        print('Please enter a menu choice...')
        choice = input('[c]ourses, [i]nstructors, [t]imes: ').upper()
    
        if choice == 'C':
            print(courses)                             # <<<
    

    I’ve changed the two lines marked with # <<<.

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

Sidebar

Related Questions

For some reason there's a variable called d that is defined immediately after I
For some reason, I am getting a weird overlapping dropdown menu glitch. It works
For some reason beyond me my html page is not finding my stylesheet. I'm
For some reason today my Android project is not loading up correctly in Eclipse.
For some reason Web does not include tzutil. You must have R2 to access
For some reason the LoadContent method does not get called in my Components. For
For some reason my webservice does not like the data I'm sending it. I
For some reason with Safari, but not other browsers, a jPlayer playlist doesn't advance
For some reason the spinner object is working only if it is defined inside
For some reason, since multitasking has arrived, NSUserDefaults seem to not save the settings

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.