Hello I am currently having trouble with one of my current homework assignments for python. I'm in the process of making a calorie counter and following along with my instructors videos he made and provided for us. I have all my code complete and done for this lesson but I keep getting an error code I have never received before. the error I keep receiving is
[code] File "E:\CC PART LESSON 811.py", line 129, in <module>
tot_cals, item_cnt = add_process(tot_cals, item_cnt)
File "E:\CC PART LESSON 811.py", line 93, in add_process
cals = calc_cals("c", g_carbs) + calc_cals("f", g_fats) + calc_cals("p", g_prot)
TypeError: 'int' object is not callable [code]
My code lets users pick whether they want to add food to their list or to end the program, and when they do add things, my code uses a function to add that item to their list, so they are prompted to input the carbs fats and protein of said item. When I finish entering in the inputs, my program crashes and it gives me the error above. I have tried googling this error and can only find solutions pertaining to specific code. What am I doing wrong and how can I go about fixing it? I have looked over my whole program multiple times and compared it with my instructors videos and can't seem to find what I did wrong! Thanks a ton!
The function and the code for it is:
while True:
choice = disp_menu()
if choice == "a":
tot_cals, item_cnt = add_process(tot_cals, item_cnt)
def add_process(tot_cals, item_cnt):
item_name = input_name()
g_carbs = input_grams("carbs")
g_fats = input_grams("fats")
g_prot = input_grams("protein")
cals = calc_cals("c", g_carbs) + calc_cals("f", g_fats) + calc_cals("p", g_prot)
my variables are as listed:
tot_cals = 0
item_list = 0
item_cnt = 0
calc_cals = 0
and sorry for the bad formatting; I am still learning how to code and use coding forums. Thanks so much guys! And also, is this enough of my code? I believe the error is coming from these two parts but I am not 100%. Thanks!