Closed fxj483 closed 4 years ago
It is totally legal to define a variable with a variable name including an integer, the integer just can't come as the first part of the variable name. So l1
is syntactically okay but 1l
is not.
Check out this link for more information.
As to the TypeError that you get when trying to iterate over enumerate(l2)
, are you sure that l2 is defined as a list containing different characters (as in the notebook) and not as a single integer?
This is not related to whether you use jupyter or a simple text file editor.
@jsr-p Thank you! I just realized the name of the list is l1 instead of 11. I didn't notice it!
I have heard that the variables should not start with numbers. However, for example, in the section of "0.3 Reusable Code", the two lists' are defined with integer values. These syntaxes work on Jupyter but not on other coding editors. Could someone explain this to me? Thank you in advance!!