Answer the question
In order to leave comments, you need to log in
How to change the value of a variable from a function?
Hello. Is there a way to change the value of a variable from within a function?
Here is a sample code. We need to replace the value of the variable n from the flop() function
n=0
@decaratorblablabla()
async def floop()
#тут какой то код вычисления
n = результат_вычисления
Answer the question
In order to leave comments, you need to log in
Through global
n=0
@decaratorblablabla()
async def flop()
global n #here
is some calculation code
n = calculation_result
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question