Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Most Energetic Track | Section 3
Python - Music

Sveip for å vise menyen

book
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 tracks list.
    • For each track, compare its energy value with highest_energy.
    • If the track's energy is greater than highest_energy, update most_energetic_track with the current track's track_name and update highest_energy with the current track's energy.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 1
py

solution.py

py

main.py

Vi beklager at noe gikk galt. Hva skjedde?

Spør AI

expand
ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

book
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 tracks list.
    • For each track, compare its energy value with highest_energy.
    • If the track's energy is greater than highest_energy, update most_energetic_track with the current track's track_name and update highest_energy with the current track's energy.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 1
Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Vi beklager at noe gikk galt. Hva skjedde?
some-alt