Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

Python Question of the Day Jan. 27, 2025

  1. Incorrect Correct No Answer was selected Invalid 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
    
    def get_num_students():
        while True:
            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 up
    print("The total number of busses needed: " + str(num_busses)) 
    Python