+ 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.
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.
+ 3
num1 = 18
num2 = 19
num3 = (num1 + num2) * 2
num4 = 76 - num3
print(num4)
its funny code =)
+ 1
x=(76//2)%18
y=(76//2)%19
print(x+y)
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 (%)?
0
x=(76//2)%18
y=(76//2)%19
print(x+y)