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…

Strings are immutable in Python — you can’t change a single character by indexing. Trying text[1] = 'i' raises a TypeError.


text = "hello": A string variable text is initialized with the value "hello" text[1] = 'i': This line attempts to change the second character (index 1) of the string text to 'i' print(text): This line will not be reached due to the error in the previous line Answer: C) Error


AI said correct answer is C Here is why:

PowerSystemAuto's tweet image. AI said correct answer is C 
Here is why:

Option A is correct


Option: c ) type error


c) Error, strings are immutable :)


type error string does not support assignment


baffled. coding in python since 7 years or so. never seen or used string indexing.🤣


C,due to immutability of strings


It depends on what the code actually is shown here.


😂😂 Such a easy q C would be the correct and String is immutable


This post is unavailable.

Definitely C


"hillo" is quite annoying 😅


Looks like a fun challenge! Can't wait to see everyone's answers. Python quizzes always spark great conversations!


Strings are immutable @codewithharry studied from you! 💪🏻


United States Trends
Loading...

Something went wrong.


Something went wrong.