Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Calculate and Print Averages | Automating Tasks with Python
Automating System Tasks with Python: A Beginner's Guide
Sezione 1. Capitolo 4
single

single

bookChallenge: 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 numbers list.
  • Determine the number of elements in the numbers list.
  • 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

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt