This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
In this article, you will learn how to solve NameError: name is not defined.
Let’s look at a code example that produces the same error.
number = 5
print(num)
# Traceback (most recent call last):
# File "example.py", line 3, in <module>
# NameError: name 'num' is not defined
How to Solve NameError: name is not defined
In order to solve it, you need to make sure that the variable has been defined first before using it.
number = 5
print(number)
# 5
The post Solved – NameError: name is not defined appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
Ariessa Norramli | Sciencx (2021-03-07T11:13:58+00:00) Solved – NameError: name is not defined. Retrieved from https://www.scien.cx/2021/03/07/solved-nameerror-name-is-not-defined/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.