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
71
17
167
20.3K
shabi
shabi@qadrishabih_·
@PythonPr X = 8 Y = 2 X = X + 6 → X = 8 + 6 = 14 Y = Y + 6 → Y = 2 + 6 = 8 print("y") → This prints the string literal "y" (not the variable Y).
English
1
0
17
1.1K
Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr Answer: y (the string literal) The distraction trap—no matter what is calculated before print("y") because it prints the STRING "y" For beginners: Variable assignments don't affect print("y") because it prints a string literal, NOT variables!
English
0
0
7
671
Robin Fultz
Robin Fultz@robin16633·
@PythonPr A) Error. Because the print statement contains text in lowercase and none of the answer options are lowercase.
English
0
0
6
830
Biel Men
Biel Men@BielMenHaha·
@PythonPr Will print y, the str instance "y"
English
0
0
2
301
Kimutai
Kimutai@kimutaitech·
@PythonPr Output’s just "y" because Python prints the literal string, not the variable. Easy to miss that detail 👀
English
1
0
1
235
Audean
Audean@audean1974·
@PythonPr Thanks for sharing this information
English
0
0
1
3
Paylaş