def f1(): global x x+=1 print(x) x=12 print("x")
The output is x. You can check the output in the code section..
Cooldude69 did you understand the answers given to you?
I got the output as x From https://code.sololearn.com/
Because you didn't call the function the output will be x
Cooldude69 Whenever you define any function you need to call the function to get your result. So here you didn't call the function. You are just printing x.
Printing a string literal results in an output string x 😁
It would output a string which is "x" as it is the one that is called by the print function. Take note that x variable and "x" is different from one another.
If I want 12 as my output, what changes do I perform?
The output is x