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.
Brianda Lopez8,318 Points
I cannot seem to get a "FizzBuzz" result. What am I doing wrong?
I have successfully returned Fizz and Buzz, but even with integers 15 and 30 I am not getting. FizzBuzz! Any assistance is appreciated.
name = input("Please enter your name: ") number = int(input("Please enter a number: ")) print("Hi,",name) print("Your number is",number,"...") if number % 3 == 0: print(number,"is a Fizz number!") elif number % 5 == 0: print(number,"is a Buzz number!") elif number % 3 == 0 and number % 5 == 0: print(number," is a FizzBuzz number!") else: print(number,"is neither a fizzy or a buzzy number.")
Jeff MudayTreehouse Moderator 26,896 Points
Your code parses properly, but!
.. be careful ... Python does the comparisons sequentially so you would never see a "FizzBuzz" because it would test as a "Fizz" number first.
Make the "FizzBuzz" test first and it will work.