I found this Python code online:
table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
>>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '
... 'Dcab: {0[Dcab]:d}'.format(table))
This executes perfectly to give me Jack: 4098; Sjoerd: 4127; Dcab: 8637678.
But when I tried removing the three dots and running the code I got an error:
table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
>>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; Dcab: {0[Dcab]:d}'.format(table))
File "<ipython-input-53-2065564231a1>", line 3
>>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; Dcab: {0[Dcab]:d}'.format(table))
^
SyntaxError: invalid syntax
Why is this happening?
What do the three dots mean?
>>>isn't part of the code.>>>?! Because that's not part of the code. The...are irrelevant. The problem is that you're trying to execute code including the>>>.