title: How can I total the inputs from this list
body: <p>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.</p>
  <pre><code>totalWeight = 0
  foodWeight = 0
  allWeight = []
  
  for counter in range (0, 4):
      print(&quot;Please enter the weight of the food in the containers&quot;)
      foodWeight = int(input(&quot;Please enter the weight of the food in the containers&quot;))
      allWeight.append(foodWeight)
      totalWeight = sum(allWeight)
  
      while foodWeight &lt; 0 or foodWeight &gt;200:
          print(&quot;Invalid, a single container can only hold up to 200g&quot;)
      for counter in range (0, 4):
          foodWeight = int(input(&quot;Please enter the weight of the food in the containers&quot;))
      break
  
  totalWeight = totalWeight + foodWeight
  print(totalWeight)
  </code></pre>