-
Written plan for the final version of your code
The final goal and purpose of the program, is to deliver a song to the user which would be a song they might like. Thus, the final plan for the code regarding my front end is to collect all the user data for each song field. These results should initially be collected and represented in a list in a useable form. With this usable form, the back end of the code should be able to check these results and compare it to all the data in the song library to find a match. The program should work to match to each field, but the recommended song at the end should not have the same title as the user put in, because this would mean that the final program would recommend the same song to the user. Therefore, the program should also work so that if there is a song title in the library, that is the same as the one which the user entered, it should be eliminated from the library and continue on to each field . To make the program more efficient and personalized, my partner and I decided to include a point system. So, this means that as the program continues and moves on to each field, each field will be rated to determine a final song. The song library will be checked to look for a song which matches the user song input. If any song in the library matches a same filed input as what the user put in, then that song will revive a points. If not, the song will receive no points. At the end, the totals of the points will be collected and the song with the most amount of points will be the song that will be recommended. If there is more than one song that have the same number of pints, then out of those songs, a song will be randomly chosen by the program. After this, one song will be recommended to the user.
Final version of the code Front End:
Final version of the code Back End:
COMBINED FINAL CODE
# mightLike.py by Jerusha and Ana
uSong = []
print(“””Hello User,the purpose of this program is to obtain information from you
about a song you like, and then use this information to match you to a song that
you might like.
Please answer the questions below about A song of your choice.”””)
uTitle = str(input(“What is the title of A song you like? ” ))
uPerf = str(input(“What is the name of the performer who performed the song? “))
# print(“Do you want us to match a song for you, by the same performer?”)
# If the user does not want a song matched to them by the same performer,
uGcheck = False
while uGcheck== False:
try:
print(“””Out of the 16 song genre choices below,
which ONE choice best matches the genre of the song?
1.Blues
2.Classical
3.Country
4.Electronic
5.Folk
6.HipHop
7.Jazz
8.Latin
9.Pop
10.Reggae
11.Religious
12.RnB
13.World
14.Rock
15.Hype
16.Other”””)
uGenre = int(input(“Your Answer>> “))
if 0< uGenre <17:
print(“ok”)
uGcheck = True
else:
print(“I need a number between 1 and 16.”)
except ValueError:
print(“I need an integer.”)
print (“Thank You!”)
uSgenre = str(input(“””What sub-genre does your song best represent?
Some examples are include Contemporary RnB, Post Grunge, Funk, Alternate Rock,
Romantic… “””))
uPrinstr = str(input(“What is THE primary instrument used in the song? “))
uLcheck = False
while uLcheck== False:
try:
print(“””Rate from 0-10, how important LYRICS are in THE song?
0 being no lyrics and 10 being lyrics are the most important in the song.”””)
uLyrics = int(input(“Your Answer>> “))
if -1< uLyrics <11:
print(“ok”)
uLcheck = True
else:
print(“I need a number between 0 and 10.”)
except ValueError:
print(“I need an integer.”)
print (“Thank You!”)
uBcheck = False
while uBcheck== False:
try:
print(“””Rate from 0-10, how important the BASS is in THE song?
0 being the bass has no strength
and 10 being the bass is very strong in the song.”””)
uBass = int(input(“Your Answer>> “))
if -1< uBass <11:
print(“ok”)
uBcheck = True
else:
print(“I need a number between 0 and 10.”)
except ValueError:
print(“I need an integer.”)
print (“Thank You!”)
uTcheck = False
while uTcheck== False:
try:
print(“””Rate from 0-10, what is the SPEED of THE song?
0 being no tempo and 10 being the fastest tempo.”””)
uTempo = int(input(“Your Answer>> “))
if -1< uTempo <11:
print(“ok”)
uTcheck = True
else:
print(“I need a number between 0 and 10.”)
except ValueError:
print(“I need an integer.”)
print (“Thank You!”)
uFcheck = False
while uFcheck== False:
try:
print(“””Out of the 13 feeling choices below,
which ONE choice best matches how you feel when you listen to the song?
1.Joyful
2.Sadness
3.Romantic
4.Anger
5.Chill
6.Motivating
7.Compassion
8.Humorous
9.Enlightening
10.Confused
11.Passionate
12.Regret
13.Grace”””)
uFeeling = int(input(“Your Answer>> “))
if 0< uFeeling <14:
print(“ok”)
uFcheck = True
else:
print(“I need a number between 1 and 13.”)
except ValueError:
print(“I need an integer.”)
print (“Thank You!”)
genres = [“blues”, “classical”, “country”, “electronic”, “folk”, “hiphop”, “jazz”, “latin”, “pop”, “reggae”, “religious”, “rnb”, “world”, “rock”, “hype”, “other”]
uGenre = genres[uGenre-1]
feelings = [“joyful”, “sadness”, “romantic”, “anger”, “chill”, “motivating”, “compassion”, “humorous”, “enlightening”, “confused”, “passionate”, “regret”, “grace”]
uFeeling = feelings[uFeeling-1]
uSong.append(uTitle)
uSong.append(uPerf)
uSong.append(uGenre)
uSong.append(uSgenre)
uSong.append(uPrinstr)
uSong.append(uLyrics)
uSong.append(uBass)
uSong.append(uTempo)
uSong.append(uFeeling)
print(uSong)
print(len(uSong))