Exercise · Operators · lesson 9 of 9
Exercise: how many buses
Write a function buses_needed(people, capacity) that returns how many buses are needed to carry people people if a bus holds capacity people. The answer is a whole number of type int.
buses_needed(90, 30)→3buses_needed(100, 30)→4buses_needed(0, 40)→0
Constraints: people is an integer from 0 to 10000, and capacity is from 1 to 100. If there are no people, no buses are needed. The last check, type(got) is int, demands exactly the int type: the answer 100.0 does not pass it.
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.