Python Question / Quiz; What is the output of the following Python code, and why? 🤔🚀 Comment your answers below! 👇 #python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming

Python_Dv's tweet image. Python Question / Quiz;

What is the output of the following Python code, and why? 🤔🚀 Comment your answers below! 👇

#python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming…

Answer: c (122). Step by step: x and y are strings, so z = "1"+"2" = "12". Then x = "12"+"2" = "122". For beginners: + with strings joins them, not adds. "1"+"2"="12", not 3.


output will be 122, which corresponds to option c. For More Reference =>>

KumarT00623760's tweet image. output will be 122, which corresponds to option c.

For More Reference =>>

Here we deal with all as strings Soooo Answer: C) 122 Explanation: First, x = "1" and y = "2". z = x + y → "1" + "2" = "12". Then x = z + y → "12" + "2" = "122"


its not maths its string joining, those numbers are inside quotes that means it is string,so we are joing it by + operators


Since the declaration variable is string so z = 12 And then x = 122 The answer is C.


C short explanation: all the strings are getting concatenated


c) 122 because they are strings


Good Code: Answer is C.


122 The variables x and y are assigned strings.


United States Trends
Loading...

Something went wrong.


Something went wrong.