What is the output? 🤔 #python #pythonquestions #quiz #techquiz #technical

preview_player
Показать описание
#codewithpatel
Рекомендации по теме
Комментарии
Автор

C) Error

Error while assigning "h" in x[0]. string object does not support item assignment.

dalius_don
Автор

Strings are immutable, which means once you define them, you can't change the values, so C is the right answer

TheMostUselessYTchannel
Автор

The string indexer [] does allow assignment because it's read-only so the answer is c.

CliffChoongo-sg
Автор

Strings are immutable hence this throws Errr
But you can concatenate to print hello like
x=“Hello”
x=“h” + x[1:]
print(x) //hello

danilove
Автор

(C) Error
because String are immutable means we can never changed

ManasTripathi-qv
Автор

The given Python code is:

x = "Hello"
y = x[0]
x[0] = "h"
print(x)

1. x = "Hello": This assigns the string "Hello" to the variable x.


2. y = x[0]: This extracts the first character ('H') from x and assigns it to y.


3. x[0] = "h": This line attempts to modify the first character of the string.



Error: Strings in Python are immutable, meaning they cannot be changed after they are created. The attempt to modify x[0] will raise a TypeError.

Thus, the correct answer is C) Error.

diablo-jo
Автор

TypeError: 'str' object does not support item assignment

StudyAccount-zn
Автор

Error: 'str' object does not support item assignment

OGs-gz
Автор

Hello cuz the print dont requires anything except x

hoangquannguyenhuu
Автор

Error aayega kyunki index ko replace nahi kiya sakta

Originalclip
Автор

bruh code is python, ouput = "hello" bruh no is Java not is C is python bruh

Mbf-B
visit shbcf.ru