Created
February 19, 2013 04:22
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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