Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

Stanislav Bezoliuk
Stanislav Bezoliuk
1,794 Points

Question Fizzbuzz challenge

name= input(" Please enter your name: ") number= int(input ("Please enter a number: "))

print= ("Hey, {} !\n The number {} ...".format(name, number))

is_buzz= number % 5==0 is_fizz= number % 3==0

if is_buzz and is_fizz: print (number, " is a fizzbuzz number")

elif is_buzz != True and is_fizz: print (number," is a fizz number") elif is_buzz and is_fizz!=True: print (number, "is a Buzz") else: print (" {} is neither fizzy or a buzzy number".format(number))

Eror-

File "hello.py", line 15, in <module>
print (number, "is a Buzz")
TypeError: 'str' object is not callable

Can you explane what do i wrong?

2 Answers

This is the culprit:

print= ("Hey, {} !\n The number {} ...".format(name, number))

I assume that, the equals sign was a mistake. If not, bear in mind that you shouldn't name a variable print, as it's the name of a built-in function.

Stanislav Bezoliuk
Stanislav Bezoliuk
1,794 Points

Such a stupid mistake(

Thank you!