Python example to create Tuple of Different Types

numericTuple = (10, 20, 30, 40, 50)
print("Numeric Tuple Items = ", numericTuple )
floatTuple = (10.25, 11.20, 19.37, 41.598)
print("Float Tuple Items = ", floatTuple )
stringTuple = ('orange', 'Mango', 'Grape', 'Apple')
print("String Tuple Items = ", stringTuple )
booleanTuple = (True, False, False, True, True)
print("Boolean Tuple Items = ", booleanTuple )
mixedTuple = ('orange', 25, 'Mango', 36.75, False, 10)
print("Mixed Tuple Items = ", mixedTuple )
nestedTuple = (10, 20, ('orange', 'Mango'), 30)
print("Nested Tuple Items = ", nestedTuple )
listTuple = (10, 20, ['Grape', 'Apple'], 70)
print("List Tuple Items = ", listTuple )

OUTPUT:

Numeric Tuple Items =  (10, 20, 30, 40, 50)
Float Tuple Items =  (10.25, 11.2, 19.37, 41.598)
String Tuple Items =  ('orange', 'Mango', 'Grape', 'Apple')
Boolean Tuple Items =  (True, False, False, True, True)
Mixed Tuple Items =  ('orange', 25, 'Mango', 36.75, False, 10)
Nested Tuple Items =  (10, 20, ('orange', 'Mango'), 30)
List Tuple Items =  (10, 20, ['Grape', 'Apple'], 70)

Leave a Comment