0
If tuples are immutable, so what is the benefit of creating an empty tuple ?
Immutable tuples
2 Respostas
+ 3
When you need a container which is empty and immutable, like a constant which can be compared to, in order to check for emptiness, or an initial container which can be concatenated with other tuples (and even itself) to form new tuples.
Trying doing this
a = ()
n = int(input())
for i in range(0, n):
a = a + (input(),)
print(a)
with input
3
this
is
working
on Code Playground.
0
The code is not working, having errors. can you review it please?
Thanks in advance :)