Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
35
11
109
15.2K
Uday Sharma
Uday Sharma@udaysharmatech·
@PythonPr It prints the character Y, not the value of Y.
Uday Sharma tweet media
English
0
0
12
453
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr The output is: y Because the code is doing updates to the variables X and Y, but the last line is print("y") — that prints the string literal "y", not the value of the variable Y. If it were print(Y), then it would print 8 (since Y = 2 and then Y = Y + 6 → 8).
English
1
0
10
1K
laso
laso@lasitolas·
@PythonPr Output should be small y..from the print("y")
English
0
1
5
748
Gnana Prasanna
Gnana Prasanna@Gnanaforlearn·
@PythonPr Output: y Because it is given in the quotes and assumed as a string. It will display as a character
English
0
0
0
2
Ahmed Maqsood
Ahmed Maqsood@hadu_itx·
@PythonPr it print y because its ok you are initiallizing 2 variables but you are printing a string "y"
English
0
0
0
158
Leila Azghandi
Leila Azghandi@LAzghandi·
@PythonPr first value for y is 2. Then new y is equal first y plus 6. so new value of y is 8. then sintax of print'y' shows 8 on the screen.
English
0
0
0
35
St Wall
St Wall@st_wall_s·
@PythonPr None. The y should be printed lowercase.
English
0
0
0
3
Prajwal Mohite
Prajwal Mohite@prajwalmohite18·
@PythonPr Answer : B) Explaination: print("Y"), this prints char Y, since it is in double qoute of print function.
English
1
0
0
42
Paylaş