+ 2

I am getting wrong output

PROGRAM:- Def Les(p): p=p+1 w=0 Print(w) Les(w) Print(w) OUTPUT:- GETTING:- 0 0 WHAT I WANT:- 0 1 Help please

8th Aug 2020, 8:23 PM
Kairav Bhatia
Kairav Bhatia - avatar
1 Answer
+ 6
the p var in the function and the w var outside are different variables. you didn't assign the new p value to w. def les(p): p=p+1 return p w=0 print(w) w = les(w) print(w)
8th Aug 2020, 8:28 PM
Randomocity
Randomocity - avatar