The object of the program is to ask the user how many articles of clothing they collected on each day of a 3 day (weekend) clothes drive, average them, do it again for the second weekend, then average the two weekends (clothes per day).
Here is my code:
import math
num_clothes = int()
weekend_total = int()
weekend_avg = float()
total_clothes = int()
total_avg = float()
index = int()
index = 1
while index <= 2:
index = 1
while index <= 3:
num_clothes = int(input("How many articles of clothing did you collect today? "))
index = index + 1
weekend_total = sum(num_clothes)
weekend_avg = weekend_total / 3
print("Total Collected:\t", weekend_total)
print("Weekend Average:\t", weekend_avg)
index = index + 1`1
total_clothes = sum(weekend_total)
total_avg = total_clothes / 6
print("Total Number of Clothing Collected:\t", total_clothes)
print("Average Collected:\t", total_avg)
And here is the error i keep getting:
Traceback (most recent call last):
File "G:\ITCS 1140\labs\python\lab 9.py", line 17, in <module>
weekend_total = sum(num_clothes)
TypeError: 'int' object is not iterable
I am trying to make num_clothes into a list and add all the values of it with sum(num_clothes).