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 trialStanislav Bezoliuk
1,794 PointsQuestion 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
Pedro Cabral
33,586 PointsThis 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
1,794 PointsSuch a stupid mistake(
Thank you!