Related to functions

it gives error

1 Like

100 is the correct answer, Try running this program in jupyter notebook @mekala.akhil2468

1 Like

@parkar-ta-ds as outside x is not assigned value before adding one to it, it will give error before even calling f1. If the answer is 100, maybe whole code is not there, but for the code seen here error should be correct answer

2 Likes

@kharshavardhan31
No it will not give you error as both x are different one is local variable having (x= 100)
And other is global variable having (x=+1)
And function will give output as per local variable inside it.
So answer will be 100

Try this

1 Like

@mekala.akhil2468 , If you check the code, it is
x = +1, it is assigning the value so the code is correct and 100 is answer but we thought it is x+=1 which is not the case.

1 Like

@kharshavardhan31
Keep it up