Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Calculate Class Attendance | Getting Started with Python for the Classroom
Python for Teachers

bookChallenge: Calculate Class Attendance

Keeping track of attendance is a common classroom task. In this challenge, you'll use a list of attendance counts to calculate the total and average attendance.

Opgave

Swipe to start coding

Write a Python script that takes a list of attendance numbers for each student, calculates the total and average attendance, and prints the results.

  • Calculate the sum of all values in attendance_list.
  • Calculate the average attendance by dividing the total by the number of students in attendance_list.
  • Print the total attendance.
  • Print the average attendance.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 7
single

single

Spørg AI

expand

Spørg AI

ChatGPT

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

Suggested prompts:

How do I calculate the total attendance from a list?

How do I find the average attendance using the attendance counts?

Can you show me an example list of attendance counts?

close

bookChallenge: Calculate Class Attendance

Stryg for at vise menuen

Keeping track of attendance is a common classroom task. In this challenge, you'll use a list of attendance counts to calculate the total and average attendance.

Opgave

Swipe to start coding

Write a Python script that takes a list of attendance numbers for each student, calculates the total and average attendance, and prints the results.

  • Calculate the sum of all values in attendance_list.
  • Calculate the average attendance by dividing the total by the number of students in attendance_list.
  • Print the total attendance.
  • Print the average attendance.

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 1. Kapitel 7
single

single

some-alt