You are on page 1of 3

Practical No:- 4

Aim : -
Software used: - Python

Question1 - print an empty tuple


Implementation: -
t=()

print(t)

Output: -

Question 2 – print a nested tuple


Implementation: -
t = ("a", [0, 2,26], (12, 2, 3))
print(t)

Output: -

Question 3– indexing with tuples


Implementation: -
t = ("a", [0, 2,26], (12, 2, 3),"c",[1,4,7,0])
print(t[0])
print(t[1][2])
print(t[4][3])

Output: -
Question 4 – negative indexing
Implementation: -
t = ("a", [0, 2,26], (12, 2, 3),"c",[1,4,7,0])
print(t[0])
print(t[-1][2])
print(t[-4][-3]

Output: -

Question 5 – Slicing
Implementation: -
t = ("a", [0, 2,26], (12, 2, 3),"c",[1,4,7,0])
print(t[-4:-2])

Output: -

Question 6 – Min() Function


Implementation: -
t1=("apple","kiwi","orange","cherry","mango")
print (min(t1))

Output: -
Question 7 – max() function
Implementation: -
t1=("apple","kiwi","orange","cherry","mango")
print (max(t1))

Output: -

Question 8 – while loop


Implementation: -
t1=("apple","kiwi","orange","cherry","mango")
i=0
while i<len(t1):
print(t1[i])
i=i+1

Output: -

You might also like