Data Abstraction
2022-09-06
types_of_food = ["fruits", "dairy", "protein", "vegetables"]
print(types_of_food)
fruit = {"bananas": 0.62, "apples": 1.23, "grapes": 2.24, "strawberries": 1.37, "oranges": 1.45 }
vegs = {"potatoes": 0.78, "tomatoes": 1.91, "onions": 0.97, "carrots": 0.49, "bell peppers": 1.46}
food = dict()
food["fruit"] = fruit
food["vegs"] = vegs
for key, value in food.items():
print(key)
blank = ""
for i in key:
blank += ""
for keys, values in value.items():
print(blank, keys, values)
fruit = {"bananas": 0.62, "apples": 1.23, "grapes": 2.24, "strawberries": 1.37, "oranges": 1.45 }
vegs = {"potatoes": 0.78, "tomatoes": 1.91, "onions": 0.97, "carrots": 0.49, "bell peppers": 1.46}
food = dict()
food["main_fruit"] = fruit
food["main_vegs"] = vegs
for key, value in food.items():
key=list(value.keys())
i=0
while(i<len(key)):
price=value[key[i]]
if(price<1.0):
print(key[i], " ",price)
i+=1
def fact(n):
if n==1:
return n
else:
return n*fact(n-1)
fact(7)