Question: USING PYTHON PROGRAMMING LANGUAGE # 0. Download the data file (.csv) provided and place it in a location you can reference. # 1. Open the

USING PYTHON PROGRAMMING LANGUAGE # 0. Download the data file (.csv) provided and place it in a location you can reference.

 # 1. Open the file for reading. # 2. Read in the file and put the results in a variable called 'text.' # 3. Generate a list of records from the text variable by splitting on the newline character. # If you want to print your result, use a for loop to see the contents of the list. # 4. Initialize variables to hold the count of the following: # -The number of number 1 hits in the dataset # -The total number of lyrics in the number 1 hits in the dataset # -The total number of occurrences of the word 'the' in the number 1 hits lyrics # -The total number of occurrences of the word 'a' in the number 1 hits lyrics # -The total number of occurrences of the word 'you' in the number 1 hits lyrics # -The total number of occurrences of the word 'yeah' in the number 1 hits lyrics # -The total number of occurrences of the word 'love' in the number 1 hits lyrics # 5. Use the for loop below to cycle through all of the songs in the dataset. # The list generated is a list of all of the song information in each record. # Print the list information if you need to see it. for line in records: list = line.split(',') # 6. If the record is a number 1 hit, increment your number 1 hit count. # Create a list called 'words' that contains the lyrics for the song (if it is a No. 1) # Use the .split() method to create a list of the 'words' if : # 7. Using the for loop provided, count the number of occurrences of the # words mentioned above by incrementing the appropriate variables. # Should NOT be case sensitive! for i in words: # 8. Generate your output using print statements. # Junk is the sum of the 'the', 'a', 'you', 'yeah', and 'love' lyrics divided by the total lyrics. # 9. Close your file!

OUTPUT: USING PYTHON PROGRAMMING LANGUAGE # 0. Download the data file (.csv) provided

Number One Hits: 51 Total Words: 14968 Total 'the': 592 Total 'a': 298 Total 'you' 754 Total 'yeah: 9e Total 'love': 109 Total Junk: 0.11094389597881049 Number One Hits: 51 Total Words: 14968 Total 'the': 592 Total 'a': 298 Total 'you' 754 Total 'yeah: 9e Total 'love': 109 Total Junk: 0.11094389597881049

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!