Learn Before
Code

NameError Example

str_time = input("What time is it now?") str_wait_time = input("What is the number of hours to wait?") time = int(str_time) wai_time = int(str_wait_time) time_when_alarm_go_off = time + wait_time print(time_when_alarm_go_off)
NameError: name 'wait_time' is not defined on line 6

In this example, there are a number of typos to fix. The first one is identified as wait_time is not defined on line 6. Now in this example you can see that there is str_wait_time on line 2, and wai_time on line 4 and wait_time on line 6.

0

1

Updated 2021-06-22

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science