Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

sample runs are really important Introduction The aim of this homework is to practice on file operations and dictionaries. In addition, please try to utilize

sample runs are really important image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Introduction The aim of this homework is to practice on file operations and dictionaries. In addition, please try to utilize functions since they would reduce the complexity of your program. Description You are given a file named "turkiye_spotify_data.txt", which stores the daily ranking of top 200 songs listened in Turkiye by Spotify users between 1st January 2017 to 9 th January 2018 (including both). Your task is to develop a Python program which, given a year and a month, recommends that month's top hits in sequence until the song the user wants to hear is found. In your program, the user will provide two inputs: year and month. Herein, the year must be either 2017 or 2018 , and the month must be between 1 and 12 , if the year is 2017; and only 1 , if the year is 2018. Your program should make sure that the inputs provided obey the rules mentioned. Your code will then process the given Spotify data to find the song with the most streams in the specified year and month. As your program suggests songs to its user, it will also ask whether they want to listen to this song or not. When the answer is yes, your program should share the uri of the song and finish afterwards. Otherwise, your program should continue suggesting upcoming songs based on the streaming number in the asked month, until the user decides to listen. Please see the "Sample Runs" section for better understanding on the flow of the proaram, the inputs and the outputs. Input File You will be given only one input file sample. The name of this input file will be turkiye_spotify_data.txt. This file contains information about the songs on Spotify, including the song's position on the chart, the track name, artist, number of streams, URL, release \&ate, and region. Each line of this file represents a different song, and the data for each song is separated by a horizontal tab character ("\t"). You can assume that the file information will be given in the correct format. Thus, you don't have to perform any format check on the file content. You can also assume that there are no duplications and no empty lines in the file. However, you cannot make any assumptions on the number of lines of this file. Keep this in mind while you're preprocessing the content of the file. THE FOLLOWING RED PART WAS ADDED LATER, PLEASE CHECK IT OUT Note that there can be different versions of some songs with the same name (but with a different url). For instance "Cheap Thr11Is" from "sia" has two different versions in January 2017 with the following links: 'https: //open, spotify .con/track/27SaWb2EzO6GW1YDBTD9j' 'https://open. 3potify, con/track/3781szndTZAR4dH8kwsLC6' Please consider them as the same song, and consider their both streaming counts, but the link for this song should be the first link that appears on this month. So, the track name + artist name together should be unique. And the link for 'cheap Thri11s, sia' in January 2017 should be the following one: 'hetpe://open. 8 potf Iy. con/track/27SdWb2rFzO6GW Y YDBTD9j' until a correct/valid input is entered by the user. - If the answer is "no", then your program should suggest the upcoming most streamed song. You can assume that the streaming numbers within each month are different for each song. And also you may assume that the user will enter "yes" at some point before we consume all songs streamed in this month. Please see the "Sample Runs" section for examples. Sample Runs Below, we provide some sample runs of the program that you will develop. The italic and bold phrases are inputs taken from the user. You have to display the required information in the same order and with the same words and characters as below. Sample Run 1 Enter the year: 2017 Enter the month: 11 NEW SUGGESTION: Etei Belinde, Manus Baba (Total stream number in this month: 1671410) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: rockstar, Post Malone (Total stream number in this month: 1531863) Sample Run 2 Enter the year: 2023 Enter the year: 2016 Enter the year: 2017 Enter the month: 6 NEW SUGGESTION: Despacito - Remix, Luis Fonsi (Total stream number in this month: 1665129) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Shape of You, Ed Sheeran (Total stream number in this month: 1455589) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Attention, Charlie Puth (Total stream number in this month: 1094736) Do you want to listen this song (enter either yes or no): yes Enjoy Attention, Charlie Puth. Here is the url for you: httos://open,spotify,com/track/4iLag9SeJSntecSPICSjxy Sample Run 3 Enter the year: 2018 Enter the month: 7 Enter the month: 4 Enter the month: 1 NEW SUGGESTION: Yanyyoruz, Burak King (Total stream number in this month: 790051) Do fou want to listen this song (enter either yes or no): no NEW SUGGESTION: Heyecan Yok, Gazapizm (Total stream number in this month: 675705) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Gmn Beni ukura, Eypio (Total stream number in this month: 560320) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: rockstar, Post Malone (Total stream number in this month: 536499) Do you want to listen this song (enter either yes or no): yes Enjoy rockstar, Post Malone. Here is the url for you: https://open, spotify. com/track/7wGoVu4Dady5GVOSv4UIsX Sample Run 4 Enter the year: 2017 Enter the month: 2 NEW SUGGESTION: Shape of You, Ed Sheeran (Total stream number in this month: 2050088) Do you want to listen this song (enter either yes or no) : nr Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Deli, Norm Ender (Total stream number in this month: 1084866) Do you want to listen this song (enter either yes or no): yes Enjoy Deli, Norm Ender. Here is the url for you: httos://open, spotify, com/track/2BZn6alrAFnKWmD4McsIAn Sample Run 5 Enter the year: 2017 Enter the month: 4 NEW SUGGESTION: Shape of You, Ed Sheeran (Total stream number in this moneh: 2144459) Do you want to listen this song (enter either yes or no): YES Enjoy Shape of You, Ed Sheeran. Here is the url for you: httos://open. spotify.com/track/7aizfU4dy1lwll 1zX7mPBI Sample Run 6 Enter the year: 2018 Enter the month: 1 NEW SUGGESTION: Yanyyoruz, Burak King (Total stream number in this month: 790051) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Heyecan Yok, Gazapizm (Total stream number in this month: 675705) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Gmn Beni ukura, Eypio (Total stream number in this month: 560320) Do you want to listen this song (enter either yes or no): 0 Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: tki Asik, Ersay Oner (Total stream number in this month: 514589) Do you want to listen this song (enter either yes or no) : no NEW SUGGESTION: Imkans7z7m, Ezhel (Total stream number in this month: 478214 ) Do you want to l4sten this song (enter efther yes or no) : no NEW SUGGESTION: Zalim, Ceylan Ertem (Total stream number in this month: 452216) Do you want to listen this song (enter either yes or no) : no NEW SUGGESTION: Geceler, Ezhel (Total stream number in this month: 433961) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Havana, Camila Cabello (Total stream number in this month: 423176) Do you want to Listen this song (enter either yes or no) : no NEW SUGGESTION: New Rules, Dua Lipa (Total stream number in this month: 406164) Do you want to listen this song (enter either yes or no) : no NEW SUGGESTION: ehrimin Tadi, Ezhel (Total stream number in this month: 380631) Do you want to listen this song (enter etther yes or no): no NEW SUGGESTION: OzLmedin mi?, simge (Total stream number in this month: 358308) Do you want to listen this song (enter efther yes or no): no NEW SUGGESTION: Hin 8 I (with Halsey), G-Eazy (Total stream number in this month: 342199) Do you want to listen this song (enter either yes or no): no NEW SUGGESTION: Etegi Belinde, Manus, Baba (Total stream number in this month: 308352 ) Do you want to listen this song (enter either yes or no): yes Enjoy Ete Betinde, Manus Baba. Here is the url for you: hrips. //lopen, spotify, com/track/3LPrslfyluXjppfsioDXDg

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions