very new to coding so please ignore my ignorance.
I am having an issue with my code i typed the code and it was doing what I wanted to it and then when I was trying to place it into user functions it stopped working I think it's a simple error but I cant find it.
the error message I'm getting as is follows
Traceback (most recent call last): line 82, in <module> main() line 64, in main bestPrice() line 21, in bestPrice w = int(size) * quantity NameError: name 'size' is not defined
But when it's not in a function it works perfectly ? please help
I've tried everything a rookie knows how to do so far
def bestPrice(): `enter code here` w = int(size) * quantity weight_50 = math.floor(w / 50) w = w - (weight_50 * 50) weight_10 = math.ceil(w / 10) print("Best Solution: ") print("Buy " + str(weight_50) + " of the 50kg bags") print("Buy " + str(weight_10) + " of the 10kg bags") price_10 = PRICE[foodTypeIndex] * weight_10 price_50 = PRICE[foodTypeIndex] * weight_50 print("Total cost using this solution: $ " + str(price_10 + price_50)) ()
basically it's a program that calculates the cost of something by someone inputting how much of the item they want and then it calculates the cost (which works) then the part of the code in question is supposed to calculate a cheaper way to do it, I just need to know what to fix
thanks for your time !!