Skip to content

Instantly share code, notes, and snippets.

@bdesham
Created February 19, 2013 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdesham/4983084 to your computer and use it in GitHub Desktop.
Save bdesham/4983084 to your computer and use it in GitHub Desktop.
Asks the user to input students’ names and grades, storing them for later use
grades = {}
for i in range(number_of_students):
# using input() can be unsafe; use raw_input() instead
name = raw_input("Name: ")
first_grade = int(raw_input("First grade: "))
second_grade = int(raw_input("Second grade: "))
grades[name] = (first_grade, second_grade)
# after running, grades will be something like
# {'Jack': (80, 90), 'Jill': (82, 98)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment