+ 1

whats wrong in it? why python is not showing uo value of y?

x=5 x+y=0 print(y)

28th Aug 2016, 4:07 PM
Govind Rathi
Govind Rathi - avatar
2 Réponses
+ 3
1) because you didn't initialize it before, you must create variable before printing it or make another operations with it 2) you can't write expressions like equations in math: x+y=0 is not correct and python will not calculate y depending on other numbers. you get an error trying to do such things. you have to write statements more clearly, like for this case: y = 0 - x or just y = -x thing you need to find/calculate is always alone and left to the '=' sign
28th Aug 2016, 5:13 PM
Demeth
Demeth - avatar
0
thanks
28th Aug 2016, 11:50 PM
Govind Rathi
Govind Rathi - avatar