tuple
mytuple = ("apple", "banana", "cherry") # ('apple', 'banana', 'cherry')
print(mytuple)
print(type(mytuple))
mytuple = (1, 3, 5) # (1, 3, 5)
print(mytuple)
print(type(mytuple))
# mytuple = tuple(1, 3, 5) # ERROR!
mytuple = tuple((1, 3, 5)) # !!! (1, 3, 5)
print(mytuple)
print(type(mytuple))
mytuple = () # ()
print(mytuple)
print(type(mytuple))
mytuple = tuple() # ()
print(mytuple)
print(type(mytuple))
mytuple = tuple("abra") # !!! ('a', 'b', 'r', 'a')
print(mytuple)
print(type(mytuple))
mytuple = tuple(("abra")) # !!! ('a', 'b', 'r', 'a')
print(mytuple)
print(type(mytuple))
mytuple = tuple(("abra",)) # !!! ('abra',)
print(mytuple)
print(type(mytuple))
Список у кортеж
my_tuple = tuple(my_list)
Last updated