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 trialOmar Hussien Khafagy
1,431 Pointsfizz buzz challenge.py
name = input("Please enter your name: ")
number = int(input(("Please enter a number: "))
print("hello" , name,"your number is" , number)
if number =(%3==0):
print("is a Fizz number.")
elif number = (%5==0):
print("is a Buzz number.")
elif number =(%3==0 and %5==0):
print("is a FizzBuzz number.")
else number=(%3!=0 and %5!=0):
print("is neither a fizzy or a buzzy number.")
plz help to fix this code !!
[MOD: added ```python formatting -cf]
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsYou have the correct idea. Some syntax to fix up:
- There's an extra open paren "(" in line 2
- The modulo syntax is
if number % 3 == 0:
orif number % 3 == 0 and number % 5 == 0:
- The last
else
has a conditional, so it should be anelif
instead
That should do it. Post back if you need more help. Good luck!!
Omar Hussien Khafagy
1,431 PointsI am sorry Second note. I didn't pay attention to it I removed the mark = So are the parentheses. thank you for help
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsThere is one additional fix. The order of the
if
statements need adjusting. Try "15", it should be a FizzBuzz but it gets called a Fizz. Can you see the issue?