Want to receive Question of the Day updates? Subscribe Here
Python Question of the Day
Jan. 27, 2025
IncorrectCorrectNo Answer was selectedInvalid Answer
The following program helps schools determine the number of busses needed for a field trip. What will be printed to the console if the following inputs are given by the user:
five hundred
0
500
import math
defget_num_students():whileTrue:try:
num_students =int(input("How many students?"))if num_students >0:return num_students
print("Invalid entry. Enter an integer greater than 0.")except ValueError:print("Not a number! Please enter an integer.")
total_students = get_num_students()
students_per_bus =48
num_busses = math.ceil(total_students / students_per_bus)#math.ceil rounds upprint("The total number of busses needed: "+str(num_busses))