Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grocery List Program
#1
I am doing a program where you input the amount of people in your family and the ages and Gender and then it asks what do you want to spend on grocery for a certain time span. I need help figuring out how to make a algorithm to calculate the grocery list and then print it out to the user.


#Tristan Fish
#Mr.Reid
#ICS3U
#12/19/2017
#12//2017
import random
#Food Groups
foodGroupGrains = "Grains"
foodGroupFruitsAndVegtables = "Fruits And Vegtables"
foodGroupDairy = "Dairy"
foodGroupProteins = "Proteins"

#totalCaloriesStore
#totalPriceStore





#def Breakfast_Food(test):
    
        
    


#Breakfast Foods
#Layout Cost,Servings,Calories,Food Group 
dempstersWholeWheatBread = [ "Dempsters Whole Wheat Bread",2.27,18,1620,foodGroupGrains]
dempstersWhiteBread =  ["Dempsters White Bread",2.27,18,1620,foodGroupGrains]
dempstersEverythingBagels = ["Dempsters Everything Bagels",2.98,12,1200,foodGroupGrains]
galaApple = ["Gala Apples",0.71,1,52,foodGroupFruitsAndVegtables]
banana = ["Bananas",0.41,1,105,foodGroupFruitsAndVegtables]
clementines = ["Clementines",2.97,20,700,foodGroupFruitsAndVegtables]
greatValueLargeEggs = ["Great Value Large Eggs",2.27,6,840,foodGroupProteins]
nelsonMilk = ["Nelson Milk",4.27,16,2080,foodGroupDairy]
greatValueOldCheddarCheese = ["Great Value Old Cheddar Cheese",4.97,5,1800,foodGroupDairy]
GreatValueVanillaYogurt = ["Great Value Vanilla Yogurt",1.77,6.5,600,foodGroupDairy]
GreatValueOrangeJuice = ["Great Value Orange Juice",1,4,440,foodGroupFruitsAndVegtables]



def Calculator():
    foodFoodGroups =  [dempstersWholeWheatBread[4],dempstersWhiteBread[3],dempstersEverythingBagels[4],galaApple[4],banana[4],clementines[4],greatValueLargeEggs[4],nelsonMilk[4],greatValueOldCheddarCheese[4],GreatValueVanillaYogurt[4],GreatValueOrangeJuice[4]]
    foodCalories =  [dempstersWholeWheatBread[3],dempstersWhiteBread[3],dempstersEverythingBagels[3],galaApple[3],banana[3],clementines[3],greatValueLargeEggs[3],nelsonMilk[3],greatValueOldCheddarCheese[3],GreatValueVanillaYogurt[3],GreatValueOrangeJuice[3]]
    foodServings = [dempstersWholeWheatBread[2],dempstersWhiteBread[2],dempstersEverythingBagels[2],galaApple[2],banana[2],clementines[2],greatValueLargeEggs[2],nelsonMilk[2],greatValueOldCheddarCheese[2],GreatValueVanillaYogurt[2],GreatValueOrangeJuice[2]]
    foodCost  = [dempstersWholeWheatBread[1],dempstersWhiteBread[1],dempstersEverythingBagels[1],galaApple[1],banana[1],clementines[1],greatValueLargeEggs[1],nelsonMilk[1],greatValueOldCheddarCheese[1],GreatValueVanillaYogurt[1],GreatValueOrangeJuice[1]]
    foodNames = [dempstersWholeWheatBread[0],dempstersWhiteBread[0],dempstersEverythingBagels[0],galaApple[0],banana[0],clementines[0],greatValueLargeEggs[0],nelsonMilk[0],greatValueOldCheddarCheese[0],GreatValueVanillaYogurt[0],GreatValueOrangeJuice[0]]
    print random.choice(foodNames), random.choice(foodCost),random.choice(foodServings),random.choice(foodCalories)



Calculator()
def Grocery_List(test):
    if timeFrame == "One Week" and moneySpent >50 and moneySpent <100 and peopleInFamly == 1 and agesOfPeopleInFamly11 >5 and agesOfPeopleInFamly11 <10 and genderOfPeople11 == "Male":
        print ("test")



#Lunch Foods
#Layout Cost,Servings,Calories,Food Group 
greatValueSlicedHam = [3.47 and 6  and 360  and foodGroupProteins]
pillarsClubSizeSmokedTurkeyBreast = [8 and 4  and 1200  and foodGroupProteins]
honeyGarlicMiniPepperoniSticks = [6.97 and 2.4  and 1400  and foodGroupProteins]
strawberryBananaYop = [0.98 and 1  and 150  and foodGroupDairy]
vanillaYop = [0.98 and 1  and 150  and foodGroupDairy]
strawberryYop = [0.98 and 1  and 150  and foodGroupDairy]
blueberryYop = [0.98 and 1  and 150  and foodGroupDairy]
minuteMaidAppleJuice = [2.97 and 10  and 1000  and foodGroupFruitsAndVegtables]
minuteMaidOrangeJuice = [2.97 and 10  and 1000  and foodGroupFruitsAndVegtables]
lunchMateHamStackers = [2.97 and 1  and 260  and foodGroupGrains]
toppablesCrackers = [2.47 and 4.5  and 2025  and foodGroupGrains]
ritzOriginalCrackers = [2.47 and 4  and 1000  and foodGroupGrains]
wheatThinsMultiGrain = [2.47 and 4  and 990  and foodGroupGrains]
mrNoodlesChicken = [0.37 and 1  and 380  and foodGroupGrains]
mrNoodlesBeef = [0.37 and 1  and 380  and foodGroupGrains]
                        
#Dinner Foods
#Layout Cost,Servings,Calories,Food Group 
bonelessChickenBreast = [10 and 5  and 800  and foodGroupProteins]
mapleLeafBonelessSkinlessChickenThighs = [10.37 and 10  and 1200  and foodGroupProteins]
mapleLeafPorkBoneless = [10 and 6  and 1020  and foodGroupProteins]
greatValueBoneLessSmokedHam = [10 and 15  and 1530  and foodGroupProteins]
leanGroundBeefTube = [4.50 and 3  and 210  and foodGroupProteins]
OneWorldHalelEyeRoundFastFrySteak = [8 and 4  and 840  and foodGroupProteins]
greatValueMacaroniAndCheese = [0.48 and 2  and 840  and foodGroupGrains]
lanciaReadyCutMacaroni = [1.27 and 6  and 3360  and foodGroupGrains]
greatValueWholeKernalCorn = [0.77 and 2  and 150  and foodGroupFruitsAndVegtables]
heinzAlphagettiPasta = [1.27 and 1  and 510  and foodGroupGrains]
carrots = [1.47 and 3  and 558  and foodGroupFruitsAndVegtables]
sweetOnions = [3.97 and 6  and 435  and foodGroupFruitsAndVegtables]
redOnions = [3.97 and 6  and 1260  and foodGroupFruitsAndVegtables]






#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
#If There Is Only 1 Person In your famly 
if peopleInFamly == 1:
    (Calculator())
    agesOfPeopleInFamly11 = int(input("How Old Are You "))
    genderOfPeople = input("What Gender Are You ") 
#If There Is 2 People In your famly
elif peopleInFamly == 2:
    agesOfPeopleInFamly12 = int(input("How Old Is the first person in your famly "))
    genderOfPeople12 = input("What Gender is the first person in your famly ")
    agesOfPeopleInFamly22 = int(input("How Old Is the Second person in your famly "))
    genderOfPeople = input("What Gender is the Second person in your famly ")
#If There Is 3 People In your famly
elif peopleInFamly == 3:
    agesOfPeopleInFamly13 = int(input("How Old Is the first person in your famly "))
    genderOfPeople = input("What Gender is the first person in your famly ")
    agesOfPeopleInFamly23 = int(input("How Old Is the Second person in your famly "))
    genderOfPeople = input("What Gender is the Second person in your famly ")
    agesOfPeopleInFamly33 = int(input("How Old Is the Third person in your famly "))
    genderOfPeople = input ("What Gender is the Thrid person in your famly ")
#If There Is 4 People In your famly
elif peopleInFamly == 4:
    agesOfPeopleInFamly14 = int(input("How Old Is the first person in your famly "))
    genderOfPeople = input("What Gender is the first person in your famly ")
    agesOfPeopleInFamly24 = int(input("How Old Is the Second person in your famly "))
    genderOfPeople = input("What Gender is the Second person in your famly ")
    agesOfPeopleInFamly34 = int(input("How Old Is the Third person in your famly "))
    genderOfPeople = input("What Gender is the Thrid person in your famly ")
    agesOfPeopleInFamly44 = int(input("How Old Is the Fourth person in your famly "))
    genderOfPeople = input("What Gender is the Fourth person in your famly ")
#If There Is 5 People In your famly
elif peopleInFamly == 5:
    agesOfPeopleInFamly15 = int(input("How Old Is the first person in your famly "))
    genderOfPeople = input("What Gender is the first person in your famly ")
    agesOfPeopleInFamly25 = int(input("How Old Is the Second person in your famly "))
    genderOfPeople = input("What Gender is the Second person in your famly ")
    agesOfPeopleInFamly35 = int(input("How Old Is the Third person in your famly "))
    genderOfPeople = input("What Gender is the Thrid person in your famly ")
    agesOfPeopleInFamly45 = int(input("How Old Is the Fourth person in your famly "))
    genderOfPeople = input("What Gender is the Fourth person in your famly ")
    agesOfPeopleInFamly55 = int(input("How Old Is the Fifth person in your famly "))
    genderOfPeople = input("What Gender is the Fifth person in your famly ")
#If There Is 6 People In your famly
elif peopleInFamly == 6:
    agesOfPeopleInFamly16 = int(input("How Old Is the first person in your famly "))
    genderOfPeople = input("What Gender is the first person in your famly ")
    agesOfPeopleInFamly26 = int(input("How Old Is the Second person in your famly "))
    genderOfPeople = input("What Gender is the Second person in your famly ")
    agesOfPeopleInFamly36 = int(input("How Old Is the Third person in your famly "))
    genderOfPeople = input("What Gender is the Thrid person in your famly ")
    agesOfPeopleInFamly46 = int(input("How Old Is the Fourth person in your famly "))
    genderOfPeople = input("What Gender is the Fourth person in your famly ")
    agesOfPeopleInFamly56 = int(input("How Old Is the Fifth person in your famly "))
    genderOfPeople = input("What Gender is the Fifth person in your famly ")
    agesOfPeopleInFamly66 = int(input("How Old Is the Sixth person in your famly "))
    genderOfPeople = input("What Gender is the Sixth person in your famly ")
#If There Is 7 People In your famly
elif peopleInFamly == 7:
    agesOfPeopleInFamly17 = int(input("How Old Is the first person in your famly "))
    genderOfPeople = input("What Gender is the first person in your famly ")
    agesOfPeopleInFamly27 = int(input("How Old Is the Second person in your famly "))
    genderOfPeople = input("What Gender is the Second person in your famly ")
    agesOfPeopleInFamly37 = int(input("How Old Is the Third person in your famly "))
    genderOfPeople = input("What Gender is the Thrid person in your famly ")
    agesOfPeopleInFamly47 = int(input("How Old Is the Fourth person in your famly "))
    genderOfPeople = input("What Gender is the Fourth person in your famly ")
    agesOfPeopleInFamly57 = int(input("How Old Is the Fifth person in your famly "))
    genderOfPeople = input("What Gender is the Fifth person in your famly ")
    agesOfPeopleInFamly67 = int(input("How Old Is the Sixth person in your famly "))
    genderOfPeople = input("What Gender is the Sixth person in your famly ")
    agesOfPeopleInFamly77 = int(input("How Old Is the Seventh person in your famly "))
    genderOfPeople = input("What Gender is the Seventh person in your famly ")
#If There Is 8 People In your famly
elif peopleInFamly == 8:
    agesOfPeopleInFamly18 = int(input("How Old Is the first person in your famly "))
    genderOfPeople = input("What Gender is the first person in your famly ")
    agesOfPeopleInFamly28 = int(input("How Old Is the Second person in your famly "))
    genderOfPeople = input("What Gender is the Second person in your famly ")
    agesOfPeopleInFamly38 = int(input("How Old Is the Third person in your famly "))
    genderOfPeople = input("What Gender is the Thrid person in your famly ")
    agesOfPeopleInFamly48 = int(input("How Old Is the Fourth person in your famly "))
    genderOfPeople = input("What Gender is the Fourth person in your famly ")
    agesOfPeopleInFamly58 = int(input("How Old Is the Fifth person in your famly "))
    genderOfPeople = input("What Gender is the Fifth person in your famly ")
    agesOfPeopleInFamly68 = int(input("How Old Is the Sixth person in your famly "))
    genderOfPeople = input("What Gender is the Sixth person in your famly ")
    agesOfPeopleInFamly78 = int(input("How Old Is the Seventh person in your famly "))
    genderOfPeople = input("What Gender is the Seventh person in your famly ")
    agesOfPeopleInFamly88 = int(input("How Old Is the Eighth person in your famly "))
    genderOfPeople = input("What Gender is the Eighth person in your famly ")
    



 
timeFrame = input("How Many Weeks Would you like to buy Groceries For ")  
# Asks For How Much Money Wants To Be Spend For 1 Week On Groceries
if timeFrame == "One Week":
    moneySpent = int(input("How Much Would You Like To Spend On Groceries For 1 Week Including Taxes "))
        
# Asks For How Much Money Wants To Be Spend For 2 Weeks On Groceries
elif timeFrame == "Two Weeks":
    moneySpent = int(input("How Much Would You Like To Spend On Groceries For 2 Weeks Including Taxes "))
         
# Asks For How Much Money Wants To Be Spend For 3 Weeks On Groceries
elif timeFrame == "Three Weeks":
    moneySpent = int(input("How Much Would You Like To Spend On Groceries For 3 Weeks Including Taxes "))
         
# Asks For How Much Money Wants To Be Spend For 4 Weeks On Groceries   
elif timeFrame == "Four Weeks":
    moneySpent = int(input("How Much Would You Like To Spend On Groceries For 4 Weeks Including Taxes "))


if  timeFrame == "OneWeek" and  moneySpent <50 and moneySpent >25 and agesOfPeopleInFamly11 >14 and agesOfPeopleInFamly11 <18 and genderOfPeople11 == "Male":
    print ("Your Grocerie list is,  ")


    
Reply


Messages In This Thread
Grocery List Program - by TFish - Jan-09-2018, 05:53 PM
RE: Grocery List Program - by mpd - Jan-09-2018, 11:10 PM
RE: Grocery List Program - by TFish - Jan-10-2018, 04:00 AM
RE: Grocery List Program - by mpd - Jan-10-2018, 12:35 PM
RE: Grocery List Program - by TFish - Jan-10-2018, 03:14 PM
RE: Grocery List Program - by mpd - Jan-10-2018, 03:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Program to find Mode of a list PythonBoy 6 1,263 Sep-12-2023, 09:31 AM
Last Post: PythonBoy
  Create a program that PING a list of IPs skaailet 7 6,671 Mar-26-2020, 10:46 PM
Last Post: snippsat
  how to open program file .exe from list SayHiii 2 2,528 Dec-11-2019, 01:28 AM
Last Post: SayHiii
  creating a list during program execution. hobbyprogrammer 2 2,468 Jan-26-2019, 09:06 PM
Last Post: hobbyprogrammer

Forum Jump:

User Panel Messages

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