214k views
4 votes
A box can fit a maximum of 5 items. Given three groups of items, num_itemsA, num_itemsB, and num_itemsC, assign num_full_boxes with the number of full boxes that the items will take up. The program will convert num_full_boxes to an integer and print the value. Sample inputs: 1 2 4 Number of full boxes: 1 num_full_boxes=0.0 num_itemsA=int(input()) num_itemsB=int(input()) num_itemsC=int(input()) "'Your solution goes here'" print(f'Number of full boxes: {int(num_full_boxes)}')

User Janbrohl
by
7.4k points

1 Answer

4 votes

Answer:

Step-by-step explanation:

num_itemsA = int(input())

num_itemsB = int(input())

num_itemsC = int(input())

total_items = num_itemsA + num_itemsB + num_itemsC

num_full_boxes = total_items // 5

print(f'Number of full boxes: {int(num_full_boxes)}')

In this code, the input values for num_itemsA, num_itemsB, and num_itemsC are read from the user using the input() function and converted to integers using the int() function. The total number of items is computed by adding the three input values. The integer division operator // is used to determine how many full boxes can be filled with the total number of items. Finally, the result is printed using an f-string, which allows us to format the output string to include the computed value of num_full_boxes as an integer.

User Knossos
by
7.8k points