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
24
7
115
8.9K
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr Answer: D) Error A tuple in Python is an immutable data type, which means that once it is created, its elements cannot be changed, added, or removed. In the code provided:  x = (1, 2, 3) creates a tuple named x containing the integers 1, 2, and 3.
English
1
0
14
572
Sergei Kotov
Sergei Kotov@kotov_dev·
Answer: D) Error Tuples are immutable -- can't be changed: › x = (1, 2, 3) creates a tuple › x[0] = 10 tries to modify it › TypeError: 'tuple' object does not support item assignment For beginners: You can read x[0], but can't write x[0] = value. Use lists [1,2,3] if you need to modify!
English
0
1
10
342
Manish Khyalia
Manish Khyalia@Manish_Kumar60·
@PythonPr Answer:-(D) Error tuples are immutable so if you change the value of any index of tuple it gives 'TypeError' error.
English
0
0
2
207
Sadashiva Sahoo
Sadashiva Sahoo@Sadashiva09·
@PythonPr ERROR, because tuple in python is immutable so it can't be done
English
0
0
1
102
DC
DC@DCx7C5·
@PythonPr tuples are immutable
English
0
0
1
24
Biel Men
Biel Men@BielMenHaha·
@PythonPr Error Tuples are imutable, so the index cannot be changed
English
0
0
1
119
Paylaş