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 trialKabelo Mayisa
Full Stack JavaScript Techdegree Student 2,556 PointsWow, I totally did it differently, is it wrong?
My solution works perfectly but it is totally different to how Ken solved it, is this a wrong thing? Heres my code:
#if devisible by both 3 and 5
if user_number % 3 == 0 and user_number % 5 == 0:
print('is a FizzBuzz number ...')
#if divisible by 3
elif user_number % 3 == 0 :
print('is a Fizz number...')
#if divisible by 5
elif user_number % 5 == 0:
print('is a Buzz number...')
#if it is either divisible by 3 or 5
else:
print('is neither a fizzy or a buzzy number ...')
2 Answers
Mark Tripney
6,009 PointsThe difference, Kabelo, is that you haven't assigned is_fizz
and is_buzz
to Boolean values, as requested in the TODO. Both methods - Ken's and yours - produce the same results, however!
Myers Carpenter
6,421 PointsLooks fine to me. Ken's answer just moved the comparisons before the if block.