Monday, December 2, 2019

finding the length of tuple in python

t1=(10,20,30)
print(len(t1))

output:
3


multiplication of Tuple in python

t1=(10,20,30)
t2=t1*2
print(t2)


output:
(10, 20, 30, 10, 20, 30)

example 2:


t1=(10,20,30)
t2=t1*3
print(t2)

output:
(10, 20, 30, 10, 20, 30, 10, 20, 30)

addition of Tuple in python

t1=(10,20,30)
t2=(40,50,60)
t3=t1+t2
print(t1)
print(t2)
print(t3)

output 1:
(10, 20, 30)
(40, 50, 60)
(10, 20, 30, 40, 50, 60)

python class topic video