Q:

Write a python program to copy elements 44 and 55 from the following tuple into a new tuple.

belongs to collection: Python Tuple Exercises

0

Copy specific elements from one tuple to a new tuple

Write a program to copy elements 44 and 55 from the following tuple into a new tuple.

Given:

tuple1 = (11, 22, 33, 44, 55, 66)

Expected output:

tuple2: (44, 55)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

tuple1 = (11, 22, 33, 44, 55, 66)
tuple2 = tuple1[3:-1]
print(tuple2)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Given is a nested tuple. Write a program to modify... >>
<< Swap two tuples in Python...