+ 4
Please give an example of where there is a need to create an empty tuple.
Tuple
4 Réponses
+ 2
really no one else wanted to share the experience?
+ 2
There are still offers?
+ 1
Its quite simple. U need to declare a tuple when u want to fill it with some values in loop. Example:
t = []
for i in range(10):
t.append(i)
that was simple example, but we can make it a lil bit more complicated. Lets say we want to add users input into tuple:
t = []
print(t) #Empty list
x = input('Input')
for i in x:
t.append(i)
print(t) #filled list