Deliver post mightLike:

  • 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:

 

mL.py A&J 6a

mL.py A&J 6b

mL.py A&J 6c

mL.py A&J 6d

 

Final version of the code Back End:

Screen Shot 2017-06-09 at 5.56.49 PM

COMBINED FINAL CODE

 

# mightLike.py by Jerusha and Ana

from librarianAL import songLib
import random

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

#List for the final matches to be put into.
finalMatch = []
for songX in range(len(songLib)):
    songLib[songX].append(0)
#Eliminates songs with the same title as the user stated.
remSongs = []
#print(“Songs in library:”, len(songLib))
for songX in range(len(songLib)):
    if uTitle == songLib[songX][0]:
        remSongs.append(songX)
#print(remSongs)
for songL in range(len(remSongs)):
    del songLib [remSongs[songL]]
#print(“Songs in library now:”, len(songLib))
#Eliminates songs with the same performer as the user stated.
for songX in range (len(songLib)):
    if uPerf == songLib[songX][1]:
        remSongs.append(songX)
#print(remSongs)
for songL in range (len(remSongs)):
    del songLib[remSongs[songL]]
#print(“Songs in library now:”, len(songLib))
#Checks the song library for the same genre and sub-genre as the user stated.
#If the genre and the sub-genre are the same, the song will begiven 3 points.
#If only the genre matches, then the song will get 2 points.
gSG = 0
for songX in range(len(songLib)):
    if songLib[songX][2] == uGenre and songLib[songX][3] == uSgenre:
        songLib[songX][9] += 3
        gSG += 1
    elif songLib[songX][2] == uGenre:
        songLib[songX][9] += 2
        #print(songLib[songX][9])
        gSG += 1
#print(“Songs with genre & subgenre matches:”, gSG)
#Checks the song library for the same primary instrument as the user stated.
#If the primary instrument matches, then the song will get 1 point.
prIn = 0
for songX in range(len(songLib)):
    if songLib[songX][4] == uPrinstr:
        songLib[songX][9] += 1
        #print(songLib[songX][0])
        prIn += 1
#print(“Songs with primary instrument matches:”,prIn)
#Checks the song library for the same lyric importance as the user stated.
#If it matches, then the song will get 2 points.
lyr = 0
for songX in range(len(songLib)):
    if songLib[songX][5] == uLyrics:
        songLib[songX][9] += 2
        #print(songLib[songX][0])
        lyr += 1
#print(“Songs with lyric matches:”,lyr)
#Checks the song library for the same bass rating as the user stated.
#If it matches, then the song will get 1 point.
bass = 0
for songX in range(len(songLib)):
    if songLib[songX][6] == uBass:
        songLib[songX][9] += 1
        #print(songLib[songX][0])
        bass += 1
#print(“Songs with bass matches:”,bass)
#Checks the song library for the same tempo rating as the user stated.
#If it matches, then the song will get 1 point.
tempo = 0
for songX in range(len(songLib)):
    if songLib[songX][7] == uTempo:
        songLib[songX][9] += 1
        #print(songLib[songX][0])
        tempo += 1
#print(“Songs with tempo matches:”,tempo)
#Checks the song library for the same feeling of the song as the user stated.
#If it matches, then the song will get 2 points.
feeling = 0
for songX in range(len(songLib)):
    if songLib[songX][8] == uFeeling:
        songLib[songX][9] += 2
        #print(songLib[songX][0])
        feeling += 1
#print(“Songs with feeling matches:”,feeling)
#Checks to see which song has the most points and then recomends it to the user.
for songA in range(len(songLib)):
    if songLib[songA][9] == 10:
        finalMatch.append(songLib[songA])
#print(“# of songs with score of 10:”, len(finalMatch))
if len(finalMatch) == 0:
    for songB in range(len(songLib)):
        if songLib[songB][9] == 9:
            finalMatch.append(songLib[songB])
    #print(“# of songs with score of 9:”, len(finalMatch))
if len(finalMatch) == 0:
    for songC in range(len(songLib)):
        if songLib[songC][9] == 8:
            finalMatch.append(songLib[songC])
    #print(“# of songs with score of 8:”, len(finalMatch))
if len(finalMatch) == 0:
    for songD in range(len(songLib)):
        if songLib[songD][9] == 7:
            finalMatch.append(songLib[songD])
    #print(“# of songs with score of 7:”, len(finalMatch))
if len(finalMatch) == 0:
    for songE in range(len(songLib)):
        if songLib[songE][9] == 6:
            finalMatch.append(songLib[songE])
    #print(“# of songs with score of 6:”, len(finalMatch))
if len(finalMatch) == 0:
    for songF in range(len(songLib)):
        if songLib[songF][9] == 5:
            finalMatch.append(songLib[songF])
    #print(“# of songs with score of 5:”, len(finalMatch))
if len(finalMatch) == 0:
    for songG in range(len(songLib)):
        if songLib[songG][9] == 4:
            finalMatch.append(songLib[songG])
    #print(“# of songs with score of 4:”, len(finalMatch))
if len(finalMatch) == 0:
    for songH in range(len(songLib)):
        if songLib[songH][9] == 3:
            finalMatch.append(songLib[songH])
    #print(“# of songs with score of 3:”, len(finalMatch))
if len(finalMatch) == 0:
    for songI in range(len(songLib)):
        if songLib[songI][9] == 2:
            finalMatch.append(songLib[songI])
    #print(“# of songs with score of 2:”, len(finalMatch))
if len(finalMatch) == 0:
    for songJ in range(len(songLib)):
        if songLib[songJ][9] == 1:
            finalMatch.append(songLib[songJ])
    #print(“# of songs with score of 1:”, len(finalMatch))
if len(finalMatch) == 0:
    for songK in range(len(songLib)):
        if songLib[songK][9] == 0:
            finM = random.randint(0, len(songLib) – 1)
            print(“According to your input, you may also like is,”, songLib[finM][0], “by”, songLib[finM][1])
if len(finalMatch) > 0:
    #print(finalMatch)
    finalM = random.randint(0, len(finalMatch) – 1)
    print(“According to your input, you may also like is,”, finalMatch[finalM][0], “by”, finalMatch[finalM][1])

Develop post mightLike:

FRONT END

VERSION 4 CODE:

MLJA4

 

VERSION 4 TEST:

ML4

VERSION 5 CODE:

mL.py A&amp;J 5a

VERSION 5 TEST:

Ml5test

VERSION 6 CODE:

mL.py A&amp;J 6a

mL.py A&amp;J 6b

mL.py A&amp;J 6c

mL.py A&amp;J 6d

VERSION 6 TEST:

mlja6

BACK END

VERSION 6 CODE:

VERSION 6 TEST:

VERSION 7 CODE:

mL7

VERSION 7 TEST:

mL7Test

VERSION 8 CODE:

mL8

VERSION 8 TEST:

mlL8Test

VERSION 9 CODE:

mL9

VERSION 9 TEST:

mL9Test

VERSION 10 CODE:

mL10

VERSION 10 TEST:

mL10test

Midpoint Status Report post:

 

  • Summary of your progress on the program (What is working? What’s not?)

Currently, the Front end of the program is complete. Right now my partner who is working on the back end of the program has made a lot of progress, but we still need to finish certain components for the back end. One such component has to do with the elimination part of our back end, which eliminates any song from the song library, which has the same title as the one the user gave. A second component is in regards to a plan that we had to include in our program. We wanted to include a point system for each song field, which will be used to deliver a song to the user, which is a good match.

  • Plan for finishing the program

To finish our program, we need to work on the elimination system with the use of a for loop. The elimination part of the project should disinclude a song with the same user song title when suggesting a final song to the user. Also using a for loop, we have to finish our program by including the point system within the loop, for each field. Once the point system also works properly, in that it collects points based on the user’s data and delivers a total number of points that will lead to one song for the user, then the program will be a success and we will be finished.

mightLike : Design

FRONT END:

Pseudocode:

  1. Explain to User purpose of program.
  2. Ask User a question for each field. (Title, Genre, Sub-genre, Performer, Feeling, Bass, Tempo, Prinstrument, and Lyrics.)(9 questions)
  3. Wrap each data field that requires a loop in a while loop, according to its data type. Fields that require a while loop include : Genre, Lyrics, Bass, Tempo and Feeling. (5 while loops)
  4. Bass, Tempo and Lyrics, in a range of integers from only 0-10.
  5. Genre and Feeling, in restricted strings with a few choices.
  6. Sub-genre, Title, Performer and Prinstrument, as non-restricted strings.
  7. Gather user entered information and make into usable form.

Front End Code Screenshots

Version 1:

mL.py A&J 1a

Version 2a & 2b

mL.py A&J 2a

mL.py A&J 2b

Version 3:

mL.py A&amp;J 3

BACK END:

 

Pseudocode:

1. Take user song input.
2. Check in a for loop if user’s song matches any song title in the song library.( if yes, eliminate from song Library if not, continue)
3. Check in a for loop if the user performer is the same in the song library. (If same, eliminate from song library and if not, continue)
4. Continue to each other field and check each field with a for loop. A point system will be used for each field, also in a for loop.
5. Check the point totals for each field.(if there is a tie, choose a random song and if there is no tie, continue)
6. Suggest song to user.

Flowchart:

 

FullSizeRender

 

Back End Code Screenshots

 

Version 1:

mightLikeVer1

 

Version 2:

mightLikrVer2

Version 3:

mightLikeVer3

Version 4:

mightLikeVer4

Data Project: Discover

Explain in plain language what it is about certain songs that makes people like them.

Certain songs have a way of drawing people to them and sometimes overtaking them. What I presume that makes people like these songs are having to do with various factors for a various people. Many a time, people are drawn to a song based on the music, lyrics, instruments, message, feeling and such. The music, instruments, lyrics, and message of a song revokes a certain feeling in the soul of the individual. The feeling being something which the person can relate to and agrees with, within themselves.

For an example, while I have no knowledge of this song, “Beautiful” by Christine Aguilera, is one song which based on the opinion of my peers, is one which they like.  One reason why they have a liking to the song, is having to do with the message that the song expresses. Yet, even this message that the song gives, all comes down to the feeling which is communicated by the message and is created in the person, which makes them like the song.

**quiz.py

  1. A photo of the flow chart for the program appears 1st on your blog post.

quizflowchart

2. The typed pseudocode for the program appears 2nd on your blog post.

pseudocode

  1. Initialize Variables
  2. Introduce purpose of program.
  3. Ask user’s name.
  4. Take user’s name input, and call them by their name.
  5. Ask user quiz questions 1-5.   
  6.  If user gives incorrect response such as a non integer or a number answer not                 between the given number choices, send back to question.
  7. For each user response, count the score of the user.
  8. Check the user score and give final feedback score on number of correct responses.

3. Screenshots of each version of the program appear in order on your blog post.

screen-shot-2017-01-20-at-9-01-21-am

screen-shot-2017-01-20-at-9-12-45-amquiz03ssquiz04ssquiz06ss

* This is the final & complete code.quiz09ss4

quiz09ss3

quiz09ss2

quiz09ss1

**aliens.py Part 2

1. a screenshot the Python code for the version of aliens.py you were working on in Part 1

aliens1c

2. a proper flowchart showing how the new version of aliens.py will run

fullsizerender

3. new pseudocode for the new version of aliens.py

pseudocode

  1. Initialize Variables.
  2. Introduce user to scenario.
  3. Ask user how many aliens landed on earth.
    1. If incorrect response occurs, send user back to question to answer again
  4. Ask user how long the aliens have been on earth
    1. If incorrect response occurs, send user back to question to answer again
  5. Black Box(Equation:Landed*2^Weeks).
  6. Program Ends.

    4. a screenshot of the Python code for the new version

aliens2bss