Python Forum
List Index out Of Range Error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List Index out Of Range Error
#1
Output:
How Many People Are In Your Famly 2 How old... 5 [5] What gender... Male ['Male'] How old... 10 [5, 10] What gender... Female ['Male', 'Female']
Error:
Traceback (most recent call last): File "C:\Users\TFish\Desktop\Python\Culminating.py", line 440, in <module> if ages[2] > 0 <= 3 and genders[2] == "Male": IndexError: list index out of range
#User Inputs
while True:
    try:
        peopleInFamly = int(input("How Many People Are In Your Famly "))
        # Amount Of Weeks Do You wanna Buy Groceries For
        

    except ValueError:
        print("Invalid Input Please Try Again")
        continue
    else:
        break
ages = []
genders = []
for x in range(peopleInFamly):
   age = int(input("How old... "))
   ages.append(age)
   print (ages)
   gender = input("What gender... ")
   genders.append(gender)
   print (genders)

# For 1st Person in famly

 #########################################
if ages[0] > 0 <= 3 and genders[0] == "Male":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1100
    totalCaloriesNeededStore.append(foodGroupProteins)


if ages[0] > 0 <= 3 and genders[0] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[0] > 4 <= 8 and genders[0] == "Male":
    foodGroupGrains = 4
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1300
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[0] > 4 <= 8 and genders[0] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1200
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[0] > 9 <= 13 and genders[0] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1800
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[0] > 9 <= 13 and genders[0] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1600
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[0] > 14 <= 18 and genders[0] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[0] > 14 <= 18 and genders[0] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[0] > 19 <= 50 and genders[0] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 8
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2200
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[0] > 19 <= 50 and genders[0] == "Female":
    foodGroupGrains = 8
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 9
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[0] > 51 <= 110 and genders[0] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[0] > 51 <= 110 and genders[0] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1700
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################

# For 2nd Person in famly


#########################################
if ages[1] > 0 <= 3 and genders[1] == "Male":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1100
    totalCaloriesNeededStore.append(foodGroupProteins)


if ages[1] > 0 <= 3 and genders[1] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[1] > 4 <= 8 and genders[1] == "Male":
    foodGroupGrains = 4
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1300
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[1] > 4 <= 8 and genders[1] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1200
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[1] > 9 <= 13 and genders[1] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1800
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[1] > 9 <= 13 and genders[1] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1600
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[1] > 14 <= 18 and genders[1] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[1] > 14 <= 18 and genders[1] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[1] > 19 <= 50 and genders[1] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 8
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2200
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[1] > 19 <= 50 and genders[1] == "Female":
    foodGroupGrains = 8
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 9
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[1] > 51 <= 110 and genders[1] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[1] > 51 <= 110 and genders[1] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1700
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################

# For 3rd Person in famly


#########################################
if ages[2] > 0 <= 3 and genders[2] == "Male":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1100
    totalCaloriesNeededStore.append(foodGroupProteins)


if ages[2] > 0 <= 3 and genders[2] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[2] > 4 <= 8 and genders[2] == "Male":
    foodGroupGrains = 4
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1300
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[2] > 4 <= 8 and genders[2] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1200
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[2] > 9 <= 13 and genders[2] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1800
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[2] > 9 <= 13 and genders[2] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1600
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[2] > 14 <= 18 and genders[2] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[2] > 14 <= 18 and genders[2] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[2] > 19 <= 50 and genders[2] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 8
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2200
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[2] > 19 <= 50 and genders[2] == "Female":
    foodGroupGrains = 8
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 9
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[2] > 51 <= 110 and genders[2] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[2] > 51 <= 110 and genders[2] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1700
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################

# For 4th Person in famly


#########################################
if ages[3] > 0 <= 3 and genders[3] == "Male":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1100
    totalCaloriesNeededStore.append(foodGroupProteins)


if ages[3] > 0 <= 3 and genders[3] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[3] > 4 <= 8 and genders[3] == "Male":
    foodGroupGrains = 4
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1300
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[3] > 4 <= 8 and genders[3] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1200
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[3] > 9 <= 13 and genders[3] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1800
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[3] > 9 <= 13 and genders[3] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1600
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[3] > 14 <= 18 and genders[3] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[3] > 14 <= 18 and genders[3] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[3] > 19 <= 50 and genders[3] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 8
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2200
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[3] > 19 <= 50 and genders[3] == "Female":
    foodGroupGrains = 8
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 9
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[3] > 51 <= 110 and genders[3] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[3] > 51 <= 110 and genders[3] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1700
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################

# For 5th Person in famly


#########################################
if ages[4] > 0 <= 3 and genders[4] == "Male":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1100
    totalCaloriesNeededStore.append(foodGroupProteins)


if ages[4] > 0 <= 3 and genders[4] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[4] > 4 <= 8 and genders[4] == "Male":
    foodGroupGrains = 4
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1300
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[4] > 4 <= 8 and genders[4] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1200
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[4] > 9 <= 13 and genders[4] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1800
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[4] > 9 <= 13 and genders[4] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1600
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[4] > 14 <= 18 and genders[4] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[4] > 14 <= 18 and genders[4] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[4] > 19 <= 50 and genders[4] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 8
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2200
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[4] > 19 <= 50 and genders[4] == "Female":
    foodGroupGrains = 8
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 9
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[4] > 51 <= 110 and genders[4] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[4] > 51 <= 110 and genders[4] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1700
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################

# For 6th Person in famly


#########################################
if ages[5] > 0 <= 3 and genders[5] == "Male":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1100
    totalCaloriesNeededStore.append(foodGroupProteins)


if ages[5] > 0 <= 3 and genders[5] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[5] > 4 <= 8 and genders[5] == "Male":
    foodGroupGrains = 4
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1300
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[5] > 4 <= 8 and genders[5] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 5
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1200
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[5] > 9 <= 13 and genders[5] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1800
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[5] > 9 <= 13 and genders[5] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 6
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1600
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[5] > 14 <= 18 and genders[5] == "Male":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 4
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[5] > 14 <= 18 and genders[5] == "Female":
    foodGroupGrains = 3
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 4
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 1
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[5] > 19 <= 50 and genders[5] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 8
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2200
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[5] > 19 <= 50 and genders[5] == "Female":
    foodGroupGrains = 8
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 9
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 2
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2100
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
if ages[5] > 51 <= 110 and genders[5] == "Male":
    foodGroupGrains = 7
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 3
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 2000
    totalCaloriesNeededStore.append(foodGroupProteins)

if ages[5] > 51 <= 110 and genders[5] == "Female":
    foodGroupGrains = 6
    foodGroupGrainsStore.append(foodGroupGrains)
    foodGroupFruitsAndVegtables = 7
    foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
    foodGroupDairy = 3
    foodGroupDairyStore.append(foodGroupDairy)
    foodGroupProteins = 2
    foodGroupProteinsStore.append(foodGroupProteins)
    totalCaloriesNeeded = 1700
    totalCaloriesNeededStore.append(foodGroupProteins)
#########################################
Reply
#2
if ages[2] > 0 and ages[2] <= 3 and genders[2] == "Male":
0 will always be <= 3
Reply
#3
Output:
What Do you want to spend on grocerys 1 Do somthing How Many People Are In Your Famly 1 How old... 5 [5] What gender... Male ['Male']
Error:
Traceback (most recent call last): File "C:\Users\TFish\Desktop\Python\Culminating.py", line 290, in <module> if ages[1] > 0 and ages[1] <= 3 and genders[1] == "Male": IndexError: list index out of range
Reply
#4
try add an 'index' variable and put 'if index<peopleInFamly' statement just below each '#For num Person in Family' to terminate the evaluation when the index exceeds the peopleInFamly limits. and also you should change every 'if statement' in your original code to what Laz+60 posted.They are shorter codes to do this but i retain the original code to suit your current coding skills
#User Inputs
while True:
    try:
        peopleInFamly = int(input("How Many People Are In Your Famly "))
        # Amount Of Weeks Do You wanna Buy Groceries For
    except ValueError:
        print("Invalid Input Please Try Again")
        continue
    else:
        break
ages = []
genders = []
for x in range(peopleInFamly):
   age = int(input("How old... "))
   ages.append(age)
   print (ages)
   gender = input("What gender... ")
   genders.append(gender)
   print (genders)

index = 0
# For 1st Person in famly
 #########################################
if index < peopleInFamly:   
    if ages[0] > 0 <= 3 and genders[0] == "Male":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
     
    if ages[0] > 0 <= 3 and genders[0] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[0] > 4 <= 8 and genders[0] == "Male":
        foodGroupGrains = 4
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1300
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[0] > 4 <= 8 and genders[0] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1200
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[0] > 9 <= 13 and genders[0] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1800
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[0] > 9 <= 13 and genders[0] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1600
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[0] > 14 <= 18 and genders[0] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[0] > 14 <= 18 and genders[0] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[0] > 19 <= 50 and genders[0] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 8
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2200
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[0] > 19 <= 50 and genders[0] == "Female":
        foodGroupGrains = 8
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 9
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[0] > 51 <= 110 and genders[0] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[0] > 51 <= 110 and genders[0] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1700
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
     
# For 2nd Person in famly
index += 1    
if index < peopleInFamly:      
     
    #########################################
    if ages[1] > 0 <= 3 and genders[1] == "Male":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
     
    if ages[1] > 0 <= 3 and genders[1] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[1] > 4 <= 8 and genders[1] == "Male":
        foodGroupGrains = 4
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1300
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[1] > 4 <= 8 and genders[1] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1200
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[1] > 9 <= 13 and genders[1] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1800
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[1] > 9 <= 13 and genders[1] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1600
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[1] > 14 <= 18 and genders[1] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[1] > 14 <= 18 and genders[1] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[1] > 19 <= 50 and genders[1] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 8
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2200
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[1] > 19 <= 50 and genders[1] == "Female":
        foodGroupGrains = 8
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 9
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[1] > 51 <= 110 and genders[1] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[1] > 51 <= 110 and genders[1] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1700
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################

# For 3rd Person in famly
index += 1
if index < peopleInFamly:
     
    #########################################
    if ages[2] > 0 <= 3 and genders[2] == "Male":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
     
    if ages[2] > 0 <= 3 and genders[2] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[2] > 4 <= 8 and genders[2] == "Male":
        foodGroupGrains = 4
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1300
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[2] > 4 <= 8 and genders[2] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1200
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[2] > 9 <= 13 and genders[2] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1800
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[2] > 9 <= 13 and genders[2] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1600
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[2] > 14 <= 18 and genders[2] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[2] > 14 <= 18 and genders[2] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[2] > 19 <= 50 and genders[2] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 8
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2200
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[2] > 19 <= 50 and genders[2] == "Female":
        foodGroupGrains = 8
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 9
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[2] > 51 <= 110 and genders[2] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[2] > 51 <= 110 and genders[2] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1700
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################

# For 4th Person in famly
index += 1       
if index < peopleInFamly:     
    #########################################
    if ages[3] > 0 <= 3 and genders[3] == "Male":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
     
    if ages[3] > 0 <= 3 and genders[3] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[3] > 4 <= 8 and genders[3] == "Male":
        foodGroupGrains = 4
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1300
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[3] > 4 <= 8 and genders[3] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1200
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[3] > 9 <= 13 and genders[3] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1800
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[3] > 9 <= 13 and genders[3] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1600
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[3] > 14 <= 18 and genders[3] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[3] > 14 <= 18 and genders[3] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[3] > 19 <= 50 and genders[3] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 8
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2200
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[3] > 19 <= 50 and genders[3] == "Female":
        foodGroupGrains = 8
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 9
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[3] > 51 <= 110 and genders[3] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[3] > 51 <= 110 and genders[3] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1700
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
 
# For 5th Person in famly
index += 1         
if index < peopleInFamly: 
    #########################################
    if ages[4] > 0 <= 3 and genders[4] == "Male":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
     
    if ages[4] > 0 <= 3 and genders[4] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[4] > 4 <= 8 and genders[4] == "Male":
        foodGroupGrains = 4
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1300
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[4] > 4 <= 8 and genders[4] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1200
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[4] > 9 <= 13 and genders[4] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1800
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[4] > 9 <= 13 and genders[4] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1600
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[4] > 14 <= 18 and genders[4] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[4] > 14 <= 18 and genders[4] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[4] > 19 <= 50 and genders[4] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 8
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2200
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[4] > 19 <= 50 and genders[4] == "Female":
        foodGroupGrains = 8
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 9
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[4] > 51 <= 110 and genders[4] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[4] > 51 <= 110 and genders[4] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1700
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
 
# For 6th Person in famly
index += 1    
if index < peopleInFamly:  
    #########################################
    if ages[5] > 0 <= 3 and genders[5] == "Male":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
     
    if ages[5] > 0 <= 3 and genders[5] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[5] > 4 <= 8 and genders[5] == "Male":
        foodGroupGrains = 4
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1300
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[5] > 4 <= 8 and genders[5] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 5
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1200
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[5] > 9 <= 13 and genders[5] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1800
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[5] > 9 <= 13 and genders[5] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 6
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1600
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[5] > 14 <= 18 and genders[5] == "Male":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 4
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[5] > 14 <= 18 and genders[5] == "Female":
        foodGroupGrains = 3
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 4
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 1
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[5] > 19 <= 50 and genders[5] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 8
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2200
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[5] > 19 <= 50 and genders[5] == "Female":
        foodGroupGrains = 8
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 9
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 2
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2100
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################
    if ages[5] > 51 <= 110 and genders[5] == "Male":
        foodGroupGrains = 7
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 3
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 2000
        totalCaloriesNeededStore.append(foodGroupProteins)
     
    if ages[5] > 51 <= 110 and genders[5] == "Female":
        foodGroupGrains = 6
        foodGroupGrainsStore.append(foodGroupGrains)
        foodGroupFruitsAndVegtables = 7
        foodGroupFruitsAndVegtablesStore.append(foodGroupFruitsAndVegtables)
        foodGroupDairy = 3
        foodGroupDairyStore.append(foodGroupDairy)
        foodGroupProteins = 2
        foodGroupProteinsStore.append(foodGroupProteins)
        totalCaloriesNeeded = 1700
        totalCaloriesNeededStore.append(foodGroupProteins)
    #########################################

print 'all family members evaluated'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  pyscript index error while calling input from html form pyscript_dude 2 976 May-21-2023, 08:17 AM
Last Post: snippsat
  Index error help MRsquared 1 763 May-15-2023, 03:28 PM
Last Post: buran
Thumbs Down I hate "List index out of range" Melen 20 3,308 May-14-2023, 06:43 AM
Last Post: deanhystad
Exclamation IndexError: Replacement index 2 out of range for positional args tuple - help? MrKnd94 2 6,318 Oct-14-2022, 09:57 PM
Last Post: MrKnd94
  IndexError: list index out of range dolac 4 1,902 Jul-25-2022, 03:42 PM
Last Post: deanhystad
  I'm getting a String index out of range error debian77 7 2,336 Jun-26-2022, 09:50 AM
Last Post: deanhystad
  IndexError: list index out of range Anldra12 2 1,438 May-03-2022, 01:39 PM
Last Post: Anldra12
  TypeError: list indices must be integers or slices, not range Anldra12 2 2,572 Apr-22-2022, 10:56 AM
Last Post: Anldra12
  matplotlib x axis range goes over the set range Pedroski55 5 3,188 Nov-21-2021, 08:40 AM
Last Post: paul18fr
  IndexError: list index out of range rf_kartal 6 2,838 Sep-07-2021, 02:36 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020