Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
make_your_grocery_list.py
# a program to make your own grocery list
# What happens: python asks for a few items and their prices to be put into a grocery list
# this program shows functions, comments, varaiables, user input and FLOAT
print("give me a food product you want in your grocery list")
food = raw_input()
#foodp = int(input('enter food foodp = int(input('enter food pric: '))
#print("what is the price of that food?")
#food_price = raw_input()
foodp = float(input('enter food price: '))
print("give me a drink to put on your list")
drink = raw_input()
#print("what is the price of the drink?")
#drink_price = raw_input()
drinkp = float(input('enter drink price: '))
print("give me a dessert item")
dessert = raw_input()
#print("what is the price of the dessert?")
#dessert_price = raw_input()
dessertp = float(input('enter dessert price: '))
my_grocery_list =[food, drink, dessert]
# prices = (food_price, drink_price, dessert_price) # is this a tuple?
prices = [foodp, drinkp, dessertp]
print("do you want me to show you all the items in your grocery list so far?")
answer1 = raw_input()
print(my_grocery_list)
print("do you want the individual prices of each item in your grocery list?")
answer2 = raw_input()
print(prices)
print("do you want me to add up the total of your list?")
answer3 = raw_input()
print(foodp + drinkp + dessertp)
#print("do you want to replace an an item in your list?")
#answer4 = raw_input()
#my_grocery_list[2] = 'juice'
#print(my_grocery_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.