+ 1
Why not working? please help
local variable reference before assignment https://code.sololearn.com/cYWy4hx6i2li/?ref=app
17 ответов
+ 9
Abhishek Mazumder , normally variables do need to be declared or initialized. But in your case you are using somethin like this:
x*=n-(r-(r-i))
so this means the same as: x = x * n-(r-(r-i)). this will assign the right side expression to x. When x is not declared, this creates an error, because x is also in the expression on the right side.
+ 2
Means that you reffer to the x variable before it is assigned
In your case it is never assigned
+ 2
Abhishek Mazumder variables in python are assighned just by giving them a value.
+ 1
Man Of Λction [TheBloodCoders] thanks a lot
+ 1
Lothar Ooooo😅
+ 1
Abhishek Mazumder,
x=x*(n-(r-(r-i)
Can only be done if x already has a value
While asigning a variable you cant use its own name in its value
+ 1
Should add an variable x=1
And then
X=n-(r(r-i))
+ 1
Телефон
+ 1
Укаво заняття
+ 1
Телефон мобільний зв'язок
0
Qwerty Uiop We have to asign variable in python?
0
Qwerty Uiop How to fix it?
0
Ooook
0
x=x*(n-(r-(r-i) and x has no value
0
Hi
0
How are you