This is another bit of my code that I posted in another question that has been giving me trouble.
I need to set the result of a function equal to a variable.
Let's say I have a function that divides pizza of x slices between y people.
def pizzaFunction(x,y):
return x/y
Simple enough. But now say I need to print that into a statement later so that the statement says
print("The number of slices per person is",slice_number)
So my question is, since
slice_number = pizzaFunction(x,y)
does not work, is there another way to do this? It is important that it be saved into some variable so that it can be used in a print statment later.
Any and all help is appreciated.
The exact error I'm getting when I try the above method is
NameError: "name 'slice_number' is not defined"