+ 2
Why does it say x isn't defined?
5 Answers
+ 3
the variable x is defined in the function definition.
define it outside the function and take it as a variable in the function:
later on call the function with variable x.
x = input()
def f(var):
blablabla
f(x)
+ 8
because you define variable x in function and it is not visible to other function, so you can change x to be global variable
+ 2
that x is a local variable used inside function
+ 1
Can I just "return" x?
+ 1
you can return x if you want to use it in an other function.
just try and see what happens.
recursion seems the way to go in the code you are writing. call the function within the function if it is a tie.