Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I can't seem to get past this what am I doing wrong??? 32] : # Your code here def highestRatedSong (songs, ratings): # defining the

I can't seem to get past this what am I doing wrong???

image text in transcribed
32] : # Your code here def highestRatedSong (songs, ratings): # defining the function highestratedsong that takres if len (songs) == len(ratings) and len(songs) > 0: highest_rated_songs = max(ratings) #initialize an empty list for storing higeest max_rating = max(ratings) for song, rating in zip(songs, ratings): #iterate through songs and ratings toget if rating == max_rating: #checking if the song has the maximum rating highest_rated_songs. append(song) return (highest_rated_songs, True) # returns a tuple containing highest rated sor else: return ( , False) # returning an empty list and False print (highestRatedSong( ["Inception", "Interstellar", "Dunkirk"], [5, 4, 5])) AttributeError Traceback (most recent call last) Cell In [32], Line 17 else: return (, False) # returning an empty list and False 17 print (highestRatedSong( ["Inception", "Interstellar", "Dunkirk"], [5, 4, 5])) Cell In [32], Line 10, in highestRatedSong ( songs, ratings) for song, rating in zip(songs, ratings): #iterate through songs and ratings together if rating == max rating: #checking if the song has the maximum rating highest_rated_songs . append(song) return (highest_rated_songs, True) # returns a tuple containing highest rate d songs and True 14 else: AttributeError: 'int' object has no attribute 'append'

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions