Usama S. answered 02/14/23
Experienced Python, ML & SQL Teacher
If you want to type the tuple with single value either its integer or any other datatype use round brackets to create a tuple and use comma after the value like
t = (42,)
for type tuple with single value comma is mandatory after the value.
If you don't use comma at the end of integer it will create a integer type variable like
t = (42) when you check its type using type() function it shows integer
t = [42,] create a list containing single integer
t = ().insert(42) throw an error because tuple doesn't have insert method and you cannot
add new value to a tuple because it is immutable (means unchangeable)