Most Energetic Track
Oppgave
Swipe to start coding
Complete a function that identifies the track with the highest energy level from a list of tracks. Each track is represented as a dictionary containing various fields, including an energy field that indicates the track's energy level.
Inputs:
tracks: A list of dictionaries, where each dictionary represents a track and contains at least the following fields:track_name: A string representing the name of the track.energy: A float representing the energy level of the track.
Steps:
- Iterate Through Tracks:
- Loop through each track in the
trackslist. - For each track, compare its
energyvalue withhighest_energy. - If the track's
energyis greater thanhighest_energy, updatemost_energetic_trackwith the current track'strack_nameand updatehighest_energywith the current track'senergy.
- Loop through each track in the
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 1
solution.py
main.py
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 5.56
Most Energetic Track
Sveip for å vise menyen
Oppgave
Swipe to start coding
Complete a function that identifies the track with the highest energy level from a list of tracks. Each track is represented as a dictionary containing various fields, including an energy field that indicates the track's energy level.
Inputs:
tracks: A list of dictionaries, where each dictionary represents a track and contains at least the following fields:track_name: A string representing the name of the track.energy: A float representing the energy level of the track.
Steps:
- Iterate Through Tracks:
- Loop through each track in the
trackslist. - For each track, compare its
energyvalue withhighest_energy. - If the track's
energyis greater thanhighest_energy, updatemost_energetic_trackwith the current track'strack_nameand updatehighest_energywith the current track'senergy.
- Loop through each track in the
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 1
solution.py
main.py