I am taking a Python programing class at college, but we've haven't done very many complicated things and I want to develop this program for my wife for one of her music classes:

A program that takes mp3s with specific titles, artists/composers, and year written/composed, and outputs random 30 sec audio samples and asks the user to give the title, artist/composer, and the year written/composed and then checks to see if the user is correct or incorrect then outputs whether or not they are correct and if not, what the correct answer/answers is/are.

_____

Ok, I've been doing this for a couple of hours now and I am really stuck even on the basic parts. Let's say we have a list of three mp3 files and for each one I want to ask the user for the title, composer, and year of the respective mp3 file then store it in a unique variable. I can't figure out how to do that. This is what I have so far.

for song in ["A", "B", "C"]:
    title = raw_input("What is " + song + "'s title? ")
    composer = raw_input("Who is " + song + "'s composer? ")
    year = input("What is " + song + "'s year? ")

The problem with this is that each time the loop runs, it will store a new value in title, composer, and year. Is there a way that each time the loop runs the variable are changed to the respective element in the list using the index variable (e.g. titleA = raw_input("What is " + song + "'s title? ")...2nd time the loop runs...titleB = raw_input("What is " + song + "'s title? ")

_____________________________________________

This is what else I have so far. Lets say, a 30 sec clip is generated of each mp3 then shuffled randomly. The next step is to quiz the individual, so this is my code for that:

if "A":
    userInputedTitle = raw_input("What is the title of this piece? ")
    if userInputedTitle == actualTitleofA:
        print "Good job! You're correct, title is", actualTitleofA
    else:
        print "Incorrect, title is", actualTitleofA

if "B":
    userInputedTitle = raw_input("What is the title of this piece? ")
    if userInputedTitle == actualTitleofB:
        print "Good job! You're correct, title is", actualTitleofB
    else:
        print "Incorrect, title is", actualTitleofB


if "C":
    userInputedTitle = raw_input("What is the title of this piece? ")
    if userInputedTitle == actualTitleofC:
        print "Good job! You're correct, title is", actualTitleofC
    else:
        print "Incorrect, title is", actualTitleofC

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!
>>>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.