+ 2
Why is it when you print a list it comes with the brackets??
lists
4 Answers
+ 5
It's printed with brackets to indicate that it is a list. You can print it any way you like, for example like this:
l = [1, 2, 3]
print(*l, sep=', ') # output: 1, 2, 3
By the way, "list" shouldn't be used as a variable name as it is a python keyword.
+ 2
Could you please specify the programmig language?
+ 2
Thanks alot😊😊
+ 1
python,
but i guess it happens in every console language...
say
list =[0,1,2]
print(list)
the output will be
[0,1,2]
is there a way of printing without the brakets??