might be able to do something like..
# Correct answers
answers = {
'songA': {'title': 'hello', 'composer': 'bob', 'year': 1984},
'songB': {'title': 'goodbye', 'composer': 'jan', 'year': 1983},
'songC': {'title': 'i love pie', 'composer': 'carl', 'year': 1982}
}
# Holder for user's anwsers
values = {}
# Ask questions
for song in answers:
values[song] = {}
values[song]['title'] = raw_input("What is " + song + "'s title? ")
values[song]['composer'] = raw_input("Who is " + song + "'s composer? ")
values[song]['year'] = input("What is " + song + "'s year? ")
# Check anwsers
for song in values:
if values[song]['title'] == answers[song]['title']:
print 'You got it %s\'s title right!' % song
if values[song]['composer'] == answers[song]['composer']:
print 'You got it %s\'s composer right!' % song
if values[song]['year'] == answers[song]['year']:
print 'You got it %s\'s year right!' % song
I personally think the way to go would be using a class, but this method will also work. Maybe at least it gives you ideas...
example output:
>>>
What is songA's title? hello
Who is songA's composer? bob
What is songA's year? 1982
What is songB's title? goodbye
Who is songB's composer? bob
What is songB's year? 1983
What is songC's title? i love cake
Who is songC's composer? jim
What is songC's year? 1982
You got it songA's title right!
You got it songA's composer right!
You got it songB's title right!
You got it songB's year right!
You got it songC's year right!
>>>