- 1
def f1(): global x x+=1 print(x) x=12 print("x")
11 Answers
+ 14
The output is x. You can check the output in the code section..
+ 9
rajul try by changing print("x") to print (x)
https://code.sololearn.com/cu8eiqpZ6sXJ/?ref=app
+ 8
Cooldude69 did you understand the answers given to you?
+ 5
I got the output as x
From
https://code.sololearn.com/
+ 4
Because you didn't call the function the output will be x
+ 4
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.
+ 2
Printing a string literal results in an output string x đ
+ 1
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.
+ 1
If I want 12 as my output, what changes do I perform?
+ 1
X
0
The output is x