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

single

bookChallenge: 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 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.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 4
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

some-alt