""" ------------------------------------------------------- [program 3] ------------------------------------------------------- Author: Anshul Khatri ID: 193313680 Email: [email protected] Section: CP164 Winter 2020 __updated__ = "2020-01-23" ------------------------------------------------------- """ from Food_utilities import read_foods, calories_by_origin from Food import Food k = open('foods.txt', 'r') goo = read_foods(k) print(Food.origins()) preference = int(input('Enter Origin of Dish (in Number) : ')) print("Average Calories of dishes from Origin: {} is :{}".format( preference, calories_by_origin(goo, preference)))
def main(): fv = open("foods.txt", "r", encoding="utf-8") foods = read_foods(fv) priority_queue_test(foods)
from Food import Food from Food_utilities import read_foods,food_table def low_cal(foods, count): """ ------------------------------------------------------- Returns a list of foods with a calorie count less than count. Use: low_cal_foods = low_cal(foods, count) ------------------------------------------------------- Parameters: foods - a list of Food objects (list of Food) count - foods must have calories below count (int) Returns: returns low_cal_foods - a list of Food (list of Food) ------------------------------------------------------- """ low_cal_foods=[ ] foods=Food('Shai',2,True,1500) if foods.calories < count : low_cal_foods=foods #+ low_cal_foods return low_cal_foods fv = open('foods.txt','r') print(Food.origins()) foods = read_foods(fv) food_table(foods) print(low_cal(foods,500))
""" ------------------------------------------------------- [program description] ------------------------------------------------------- Author: Anshul Khatri ID: 193313680 Email: [email protected] Section: CP164 Winter 2020 __updated__ = "2020-01-27" ------------------------------------------------------- """ from utilities import priority_queue_test from Food_utilities import read_foods list_ = [] k = open('foods.txt', 'r') g = read_foods(k) priority_queue_test(g)
Section: CP164 Winter 2020 __updated__ = "2020-03-05" ------------------------------------------------------------- """ from Food import Food from Food_utilities import read_foods from Sorted_List_linked import Sorted_List list_1 = Sorted_List() list_2 = Sorted_List() print("Identical:",list_1.is_identical(list_2)) print("---------") print() f_vp = open("food.txt",'r') foods = read_foods(f_vp) f_vp2 = open("food2.txt",'r') foods2 = read_foods(f_vp2) for i in range(len(foods)): list_1.insert(foods[i]) for i in range(len(foods2)): list_2.insert(foods2[i]) for t in list_1: print(t) print("---------") print() list_1.remove_many(foods[0])
""" ------------------------------------------------------- [program description] ------------------------------------------------------- Author: Anshul Khatri ID: 193313680 Email: [email protected] Section: CP164 Winter 2020 __updated__ = "2020-03-22" ------------------------------------------------------- """ from functions import hash_table from Food_utilities import read_foods f_v = open("foods.txt", "r") foods = read_foods(f_v) hash_table(6, foods)
""" ------------------------------------------------------- [program 2] ------------------------------------------------------- Author: Anshul Khatri ID: 193313680 Email: [email protected] Section: CP164 Winter 2020 __updated__ = "2020-02-05" ------------------------------------------------------- """ from utilities import list_test from Food_utilities import read_foods fv_ = open('foods.txt', 'r') source = read_foods(fv_) list_test(source)
__updated__ = "2020-03-05" ------------------------------------------------------------- """ from Food import Food from Food_utilities import read_foods from List_linked import List l1 = List() l2 = List() print("Identical:", l1.is_identical(l2)) print("----------") print() fv = open("food.txt", 'r') foods = read_foods(fv) fv2 = open("food2.txt", 'r') foods2 = read_foods(fv2) for a in range(len(foods)): l1.insert(a, foods[a]) for a in range(len(foods2)): l2.insert(a, foods2[a]) for a in l1: print(a) print("----------") print() l1.remove_many(foods[0]) print("***Lasagna Removed***")