What

RO/Immutable lists ie values inside tuples cannot be changed.

a = [1,2,3,4]
a[0]=5                 #'tuple' object does not support item assignment
        
Length of empty tuple = 0

e = ()
print(e)        #()
print(len(e))   #0
        
Nested Tuple

n = a,(4,5,'h')
print(n)        #((1, 3, 'f', 'my'), (4, 5, 'h'))
        

Create Tuple


// Creating after Input from user
a = input("Input some comma seprated numbers : ")     #1,2,3,4
t = tuple(a)
print('Tuple:',t)                                     #(1,2,3,4)

// Created with or without ()
b = (1,3,'f','my')
a = 1,3,'f','my'
print(a)                #(1, 3, 'f', 'my')

//Creating Tuples from list
c = ([1, 2, 3])
print(c)        #[1, 2, 3]
c[0]=4
print(c)        #[4, 2, 3]
        

Packing/Unpacking of Tuples

PACKING: Filling the values inside tuple
UNPACKING: Unpacking the tuple to variables

            f = 12345, 54321, 'hello!'      #PACKING
            x,y,z = f                       #UNPACKING to values
            print(x,y,z)                    #12345 54321 hello