Answer:
cards, sweets, stationery, toys = 0
for i in range 0 to 280
Input the code
digit = int(code/100)
if digit == 0:
cards += 1
elif digit == 1:
sweets += 1
elif digit == 2:
stationery += 1
elif digit == 3:
toys += 1
output cards, sweets, stationery, toys
Step-by-step explanation:
- Set all the counts as zero at the beginning
- Initialize a for loop that iterates 280 times
- Ask user to enter the code
- Get the code's first digit by dividing 100
- Depending on the digit, increment the counts of the items
- When the loop is done, print the count of the items