Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Comparison Solution

Dan B
Dan B
6,155 Points

NameError: name 'if_buzz' is not defined

When running the same code as the teacher's solution.

Inputting the number: 234

Results in this error:


treehouse:~/workspace$ python challenge.py
Please enter your name: Name
Please enter a number: 234
Hello Name!
The number 234...
Traceback (most recent call last):
File "challenge.py", line 30, in <module>
if is_fizz and if_buzz:
NameError: name 'if_buzz' is not defined


The code is exactly the same as the teacher's solution. What causes this error?

It works fine with pretty much every other number.

Steven Parker
Steven Parker
229,732 Points

What you posted is a temporary workspace link. To get a permanent link you need to use the snapshot function (button with camera icon).

2 Answers

Dan B
Dan B
6,155 Points

Thanks Chris, you found it! It was that typo.