Osio 1. Luku 4
single
Challenge: Calculate and Print Averages
Pyyhkäise näyttääksesi valikon
Tehtävä
Pyyhkäise aloittaaksesi koodauksen
Write a function that calculates and prints the average of a given list of numbers.
- Calculate the sum of all numbers in the
numberslist. - Determine the number of elements in the
numberslist. - If the list is empty, set the average to 0.
- Otherwise, divide the sum by the number of elements to get the average.
- Print a message displaying the calculated average.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 4
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme