As soon as you learn Python for the first time, understanding the meaning of Python error messages can be a bit complicated. Please refer to the following for error hints that you often see.
Error hint: SyntaxError: invalid syntax The error occurs in the following code.
Error hint: SyntaxError: invalid syntax "=" Is an assignment operator, and "=" is a comparison operation. The error occurs in the following code.
Error hint: TypeError: ‘list’ object cannot be interpreted as an integer The index typically iterates over the elements of list or string. To do this, you need to call the range () function. Remember to return the len value instead of returning this list. The error occurs in the following code.
Error hint: TypeError: ‘str’ object does not support item assignment string is an immutable data type and the error occurs in the following code.
Error hint: TypeError: Ca n’t convert ‘int’ object to str implicitly The error occurs in the following code.
Error hint: SyntaxError: EOL while scanning string literal Error Occurs with the following code.
Error hint: SyntaxError: EOL while scanning string literal Python keywords cannot be used as variable names. This error occurs in the following code:
Error hint: AttributeError: ‘str’ object has no attribute ‘lowerr’ This error occurs in the following code:
Error hint: IndexError: list index out of range This error occurs in the following code:
It's important to remember that range () actually returns a "range object" instead of a list value. Error hint: TypeError: ‘range’ object does not support item assignment This error occurs in the following code:
Recommended Posts