+ 1

Please anyone explain this to me ???

num1, num2 =3,3 num1-=3 num2 = -3 print(num1 + num2)

21st Jul 2020, 11:41 AM
Tek Narayan mehato
Tek Narayan mehato - avatar
4 Respostas
+ 6
In first(num1-=3) you're subtracting 3 from original value and in 2nd case you are changing num2 value to -3 So the output will be -3
21st Jul 2020, 11:43 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 3
num1 is initially 3. "num1-=3" gives 3-3 which is 0. num2 is initially 3. Now "num2=-3" changes the initial value of num2 from 3 to -3. So "print(num1+num2)" will print the sum of the final values of both num1 which is 0 and num2 which is -3 and gives 0+-3= -3.
21st Jul 2020, 11:50 AM
Rawley
Rawley - avatar
+ 1
3-3 will be 0 then
21st Jul 2020, 11:49 AM
Tek Narayan mehato
Tek Narayan mehato - avatar
0
yaa tq i got it
21st Jul 2020, 11:55 AM
Tek Narayan mehato
Tek Narayan mehato - avatar