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 =>>
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
United States Trends
- 1. Seahawks 21.5K posts
- 2. Giants 67.1K posts
- 3. Bills 138K posts
- 4. Bears 60K posts
- 5. Daboll 11.9K posts
- 6. Jags 6,825 posts
- 7. Dart 26.2K posts
- 8. Caleb 49.1K posts
- 9. Dolphins 32.8K posts
- 10. Rams 16.8K posts
- 11. Josh Allen 16.1K posts
- 12. Texans 38.2K posts
- 13. Russell Wilson 4,024 posts
- 14. Browns 38K posts
- 15. Patriots 107K posts
- 16. Ravens 38K posts
- 17. Trevor Lawrence 2,537 posts
- 18. Bryce 15.8K posts
- 19. Henderson 17.5K posts
- 20. Niners 3,285 posts
Something went wrong.
Something went wrong.