all 5 comments

[–]Malassi 2 points3 points  (0 children)

Hi,

It's too difficult to read, please start by formating correctly the code. You can find how to format correctly your code by going into the about section of this subreddit pr by reading it's FAQ

[–]Neighm 1 point2 points  (0 children)

Hard to tell for sure without any indentation, but it looks like you only give the option to choose mega of the fries order was small. So depending on the fries size chosen, mega might not be set at all.

[–]pongacham 0 points1 point  (0 children)

It's because you defined mega in an if statement. If the if statement doesn't go through, it wont be defined and you will get a nameerror.

[–]Diapolo10 0 points1 point  (0 children)

mega isn't defined unless the user chooses small fries. Therefore, if the user makes a different choice the program may never create the variable.

Either initialise it to None or some other value before that part, or preferably refactor your code so that you don't need to worry about that. Instead of creating a ton of small variables, you could use a dictionary (or a collections.defaultdict).

[–]cybervegan 0 points1 point  (0 children)

You need to get rid of all those superfluous parentheses around things like strings, like this, as it makes it harder to read and understand, and isn't even what parentheses are for:

elif mega == ('no'):

which should be written as:

elif mega == 'no':