I started learning python. I learned that a function cannot use values if they are not defined as parameters, but I was practicing and made a little program calling a function without parameters and it works. I don't understand why does it works, can someone please explain why does the program works?
Here is the code:
def sum():
return x + y
x = 10
y = 20
print("Total: ", sum())