Common tuple operations/mathematical operator for tuple
i. Tuple Addition:- दो tuples को आपस में जोड़ने के लिए concatenate operator (+) का used किया जाता है।
a=(10,20,30,40)
b=(2,4,6,8)
c=a+b
print(c) # (10, 20, 30, 40, 2, 4, 6, 8)
a=(10,20,30,40)
c=a+(5,)
print(c) # (10, 20, 30, 40, 5)
ii. Tuple Multiplication:- multiplication operator (*) का used tuple element को repeat करने के लिए किया जाता है।
a=(10,20,30)
c=a*2
print(c) # (10, 20, 30, 10, 20, 30)
Common tuple operations/mathematical operator for tuple
i. Tuple Addition:- The concatenate operator (+) is used to join two tuples together.
a=(10,20,30,40)
b=(2,4,6,8)
c=a+b
print(c) # (10, 20, 30, 40, 2, 4, 6, 8)
a=(10,20,30,40)
c=a+(5,)
print(c) # (10, 20, 30, 40, 5)
ii. Tuple Multiplication:- Multiplication operator (*) is used to repeat tuple elements.
a=(10,20,30)
c=a*2
print(c) # (10, 20, 30, 10, 20, 30)