- 1

def f1(): global x x+=1 print(x) x=12 print("x")

18th Sep 2020, 3:39 AM
Cooldude69
Cooldude69 - avatar
11 odpowiedzi
+ 14
The output is x. You can check the output in the code section..
18th Sep 2020, 3:43 AM
Aditya
Aditya - avatar
+ 9
rajul try by changing print("x") to print (x) https://code.sololearn.com/cu8eiqpZ6sXJ/?ref=app
19th Sep 2020, 5:11 PM
Aditya
Aditya - avatar
+ 8
Cooldude69 did you understand the answers given to you?
18th Sep 2020, 5:48 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 5
I got the output as x From https://code.sololearn.com/
18th Sep 2020, 3:43 AM
Nilesh
Nilesh - avatar
+ 4
Because you didn't call the function the output will be x
18th Sep 2020, 3:44 AM
Sreenandan K M
Sreenandan K M - avatar
+ 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.
18th Sep 2020, 4:12 AM
A͢J
A͢J - avatar
+ 2
Printing a string literal results in an output string x 😁
20th Sep 2020, 3:07 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 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.
18th Sep 2020, 7:57 PM
Joseph Sambo II
Joseph Sambo II - avatar
+ 1
If I want 12 as my output, what changes do I perform?
19th Sep 2020, 4:57 PM
rajul
+ 1
X
20th Sep 2020, 1:32 AM
flv
0
The output is x
19th Sep 2020, 8:48 PM
Curious
Curious - avatar