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