Practical tasks and linear programs
Answers are for parents and teachers.
1
A bus has 45 seats. 320 pupils are going on a trip. How many buses are full and how many pupils are on the last bus (using // and %)?
7 full buses, and 5 pupils on the last (8th) bus (320 // 45 = 7, 320 % 45 = 5).
2
The three sides of a triangle are typed on one line with spaces. Write a program that prints its perimeter (12 if 3 4 5 is typed).
a = input().split() ⏎ print(int(a[0]) + int(a[1]) + int(a[2]))
3
Three classes have 28, 31 and 26 pupils. If 2 sit at each desk, how many desks are needed (for each class separately, rounded up)?
14 + 16 + 13 = 43
4
The kinetic energy of a body of mass m and speed v is E = m * v**2 / 2. Find E for m = 4, v = 3.
18