Advertisement
splinter10066

Untitled

Dec 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. adminCourses = ('Slam Poetry 101', 'Eating', 'Farting', 'Intro to Cheeseburgers') #makes your admin courses
  2. studentCourses = ('Sleeping', 'Failing', 'Water Bottle', 'uhhhh') #makes student courses
  3. courses = {}   #makes an empty dictionary
  4. courses['admin'] = adminCourses   #creates a key and assigns values
  5. courses['student'] = studentCourses
  6.  
  7. print('This is a menu')
  8. print('Press 1 for admin courses')
  9. print('Press 2 for student courses')
  10. userInput = input()
  11. if userInput == '1':
  12.     for x in courses.get('admin'):  #dictionary.get(key) will return the values and you're looping over it in a for loop. So for each loop, x will be the next item in the list
  13.         print(x)
  14. if userInput == '2':
  15.     for x in courses.get('student'):
  16.         print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement