Most Energetic Track
Task
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
tracks
list. - For each track, compare its
energy
value withhighest_energy
. - If the track's
energy
is greater thanhighest_energy
, updatemost_energetic_track
with the current track'strack_name
and updatehighest_energy
with the current track'senergy
.
- Loop through each track in the
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 1
solution.py
main.py
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 5.56
Most Energetic Track
Swipe to show menu
Task
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
tracks
list. - For each track, compare its
energy
value withhighest_energy
. - If the track's
energy
is greater thanhighest_energy
, updatemost_energetic_track
with the current track'strack_name
and updatehighest_energy
with the current track'senergy
.
- Loop through each track in the
Solution
Everything was clear?
Thanks for your feedback!
Awesome!
Completion rate improved to 5.56SectionΒ 3. ChapterΒ 1
solution.py
main.py