A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

The given tuple is a nested tuple. write a Python program to print the value 20
Q:

The given tuple is a nested tuple. write a Python program to print the value 20

0

Access value 20 from the tuple

The given tuple is a nested tuple. write a Python program to print the value 20.

Given:

tuple1 = ("Orange", [10, 20, 30], (5, 15, 25))

Expected output:

20

All Answers

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

Hint:

The given tuple is a nested tuple. Use indexing to locate the specified item.

Solution:

tuple1 = ("Orange", [10, 20, 30], (5, 15, 25))

# understand indexing
# tuple1[0] = 'Orange'
# tuple1[1] = [10, 20, 30]
# list1[1][1] = 20

print(tuple1[1][1])

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

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now