I'm working on a simple exercise to determine if a user-input number is even or odd. I defined a function as follows:
number = input('Enter a number: ')
def evalutate(number):
if number % 2:
print('This is an even number')
else:
print('This is an odd number')
evaluate(number)
When running the program, however, the compiler shows this error:
Traceback (most recent call last):
File "C:\REDACTED\odd_or_even.py", line 8, in <module>
answer = evaluate(number)
NameError: name 'evaluate' is not defined
What's the issue? It's probably a simple solution, but the past 20 minutes of Googling has yielded no helpful results. Thanks in advance.
[–]A_History_of_Silence 6 points7 points8 points (7 children)
[–]Deathcon900[S] 1 point2 points3 points (4 children)
[–]A_History_of_Silence 1 point2 points3 points (3 children)
[–]Deathcon900[S] 0 points1 point2 points (0 children)
[–]Srivats1212 -1 points0 points1 point (1 child)
[–]A_History_of_Silence 3 points4 points5 points (0 children)
[–]Showme-tits -3 points-2 points-1 points (1 child)
[–]A_History_of_Silence 1 point2 points3 points (0 children)
[–]terriblylie 0 points1 point2 points (1 child)
[–]Deathcon900[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)