Write the output of the given python code :
#!/user/bin/python
tup1 = (12, 34.56)
tup2 = (‘abc’, ‘xyz’)
#Following action is not valid for tuples
#tup1 [0] = 100
#So let’s create a new tuple as follows
tup3 = tup1 + tup2
print tup3
Answers
Answered by
4
The output is (12, 34.56, 'abc', 'xyz')
Explanation:
A tuple is a sequence of objects in Python, that is immutable. Tuples are immutable which means we cannot update or change the values of tuple elements. We can portion of existing tuples to create new tuples.
In the code snippet,
- tup1 = (12, 34.56)
- tup2 = (‘abc’, ‘xyz’)
- tup3 = tup1 + tup2
When this statement get executed then tup3 = (12, 34.56, 'abc', 'xyz')
- print tup3
When this statement get executed the output is (12, 34.56, 'abc', 'xyz')
- The output is (12, 34.56, 'abc', 'xyz')
Answered by
0
Answer:
please mark me as brainlist
Attachments:
Similar questions
History,
5 months ago
Business Studies,
5 months ago
Computer Science,
11 months ago
Chemistry,
1 year ago