-
Notifications
You must be signed in to change notification settings - Fork 0
Collections with strings inside of it
AndrewMZ edited this page May 1, 2022
·
1 revision
There's difference between numerical and string behavior inside collections:
my_list = ['hello' 'this' 'is' 'my' 'message']
my_tuple = ('hello' 'this' 'is' 'my' 'message')
my_set = {'hello' 'this' 'is' 'my' 'message'}
The result in all cases going to be the same
['hellothisismymessage']
('hellothisismymessage')
{'hellothisismymessage'}
when we try to do the same with numerical types we get syntax error
>>> l = {1 2 3 4 5}
File "<stdin>", line 1
l = {1 2 3 4 5}
^
SyntaxError: invalid syntax