Sezione 1. Capitolo 4
single
Challenge: Calculate and Print Averages
Scorri per mostrare il menu
Compito
Scorri per iniziare a programmare
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 4
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione