Final answer:
To keep track of the number of stamps collected each month and calculate the total for the year, you can use a loop in Python.
Step-by-step explanation:
To solve this problem, we can use a loop to iterate through the 12 months and keep a running total of the number of stamps collected. Here is a Python program that implements this:
total_stamps = 0
for i in range(12):
month = input('Enter the name of the month: ')
stamps = int(input('Enter the number of stamps collected this month: '))
total_stamps += stamps
print('Total stamps collected for the year:', total_stamps)
This program uses a for loop to iterate through the numbers 0 to 11, representing the 12 months. Inside the loop, it asks the user for the name of the month and the number of stamps collected. The total_stamps variable keeps track of the running total. Finally, outside the loop, it prints the total number of stamps collected for the year.