I cannot seem to get the correct total from the 5 inputs. Anything I have tried so far has outputted seemingly random numbers. All I want to do is get the total number of grams entered. Any help would be appreciated.
totalWeight = 0
foodWeight = 0
allWeight = []
for counter in range (0, 4):
print("Please enter the weight of the food in the containers")
foodWeight = int(input("Please enter the weight of the food in the containers"))
allWeight.append(foodWeight)
totalWeight = sum(allWeight)
while foodWeight < 0 or foodWeight >200:
print("Invalid, a single container can only hold up to 200g")
for counter in range (0, 4):
foodWeight = int(input("Please enter the weight of the food in the containers"))
break
totalWeight = totalWeight + foodWeight
print(totalWeight)