+ 1

I am beginner help me

We need to distribute math and history textbooks to students. There are 2 class sections: the first section has 18 pupils, and the second one has 19. The total number of books available for distribution is 76. Write a program to calculate and output how many books will be left after each student receives both books.

2nd Jan 2021, 9:34 AM
Shivam Tanwar
Shivam Tanwar - avatar
5 Respostas
+ 6
The question doesn't specify if there are enough of both types of books. Are there an equal number of each type or could there be 70 math texts and 6 history texts? Figure out what your code has to do before you start writing it. Here you want to multiply the total number of students by 2 and subtract from 76, i.e. 76 - (18 + 19) * 2 Then write a piece of Python that will print that out. If you post the code you've tried so far, we can help you with that.
2nd Jan 2021, 9:49 AM
David Ashton
David Ashton - avatar
+ 3
num1 = 18 num2 = 19 num3 = (num1 + num2) * 2 num4 = 76 - num3 print(num4) its funny code =)
16th Feb 2021, 4:31 PM
Michael
Michael - avatar
+ 1
x=(76//2)%18 y=(76//2)%19 print(x+y)
23rd Jun 2021, 5:53 PM
D.M.M.L.Dissanayake
0
Remainder We need to distribute math and history textbooks to students. There are 2 class sections: the first section has 18 pupils, and the second one has 19. The total number of books available for distribution is 76. Write a program to calculate and output how many books will be left after each student receives both books. Use the modulo operator (%) to get the remainder. But where is use (%)?
27th Apr 2021, 8:26 AM
Элмурод Жураев
Элмурод Жураев - avatar
0
x=(76//2)%18 y=(76//2)%19 print(x+y)
23rd Oct 2021, 5:40 AM
amaresh
amaresh - avatar