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

Can you help me out!

name = input("Please enter your name: ")
number = int(input("Please enter a number: "))
if number % 3 ==0:
    print("hello {} , {} is a Fizz number.".format(name,number))
elif number % 5 ==0:
    print("hello {} , {} is a Buzz number.".format(name,number))
elif number % (5,3) == 0 :
    print("hello {} ,{} is a FizzBuzz number.".format(name,number))
else:
    print("hello {} , {} is neither a fizzy or a buzzy number.".format(name,number))

[MOD: added ```python formatting -cf]

boi
boi
14,242 Points

First, learn to use code formatting please, go here.

Josh Keenan
Josh Keenan
20,315 Points

What is this related to, or what is the issue you are having?

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

There are two errors here:

  • The module operator "%" does not take a tuple. Instead you need two expressions ANDed together
  • The order of the if conditions needs to be reversed. If a number is buzzy and fizzy, it would satisfy the buzzy before being check for also being fizzy.

Post back if you need more help. Good luck!!