31st Jan 2018, 7:42 PM
Raphael Shay
Raphael Shay - avatar
5 Réponses
+ 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)
31st Jan 2018, 7:59 PM
davy hermans
davy hermans - avatar
+ 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
31st Jan 2018, 7:55 PM
Vukan
Vukan - avatar
+ 2
that x is a local variable used inside function
31st Jan 2018, 7:54 PM
Kuba H
Kuba H - avatar
+ 1
Can I just "return" x?
1st Feb 2018, 6:43 AM
Raphael Shay
Raphael Shay - avatar
+ 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.
1st Feb 2018, 9:02 AM
davy hermans
davy hermans - avatar