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

Stryg for at vise menuen

book
Mode Distribution

Opgave

Swipe to start coding

Complete a function that determines the musical mode of a track based on its mode value. The mode is represented as an integer, where a value of 1 indicates a major mode and a value of 0 indicates a minor mode.

Inputs:

  • mode: An integer representing the mode of the track. It can be either:
    • 1 for major mode.
    • 0 for minor mode.

Steps:

  • Determine Mode: Check the value of the mode input. If mode is 1, the track is in a major mode, otherwise it is in a minor mode.

  • Return the Mode:

    • Return the string 'major' if it is major mode.
    • Return the string 'minor' if it is minor mode.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 5
py

solution.py

py

main.py

Vi beklager, at noget gik galt. Hvad skete der?

Spørg AI

expand
ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

book
Mode Distribution

Opgave

Swipe to start coding

Complete a function that determines the musical mode of a track based on its mode value. The mode is represented as an integer, where a value of 1 indicates a major mode and a value of 0 indicates a minor mode.

Inputs:

  • mode: An integer representing the mode of the track. It can be either:
    • 1 for major mode.
    • 0 for minor mode.

Steps:

  • Determine Mode: Check the value of the mode input. If mode is 1, the track is in a major mode, otherwise it is in a minor mode.

  • Return the Mode:

    • Return the string 'major' if it is major mode.
    • Return the string 'minor' if it is minor mode.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 5
Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Vi beklager, at noget gik galt. Hvad skete der?
some-alt