+ 4

Please give an example of where there is a need to create an empty tuple.

Tuple

28th Feb 2017, 11:20 AM
Арсен Дарбишев
Арсен Дарбишев - avatar
4 odpowiedzi
+ 2
really no one else wanted to share the experience?
28th Feb 2017, 12:46 PM
Арсен Дарбишев
Арсен Дарбишев - avatar
+ 2
There are still offers?
22nd Mar 2017, 9:06 PM
Арсен Дарбишев
Арсен Дарбишев - avatar
+ 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
5th May 2017, 6:28 PM
Tommy L
Tommy L - avatar