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

Abhinandan vig
Abhinandan vig
445 Points

i was able to get this fizzBuzz code running without using boolean - is that right ?? Check my code below this !

name = input("Please enter your name: ") number = int(input("Please enter a number: "))

print("hey", name) print("Your no", number)

if number%3 == 0 and number%5 == 0: print("is a fizzBuzz") elif number%3 == 0: print("is a fizzz") elif number%5 == 0: print("buzz") else: print(" is neither")


So i could not understand how to in corporate Boolean variables like is_fizz and is_buzz as mentioned in the todo list. So i went with this approach. Can anybody help ?? In detail and i am little confused with Boolean. tHANKS.

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Abhinandan,

Please ensure you always use proper code formatting when posting code. You can view the markdown cheatsheet by clicking the link below the text entry field.

This is always important for code readability but is especially important with Python where whitespace is significant.

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

FizzBuzz is a common exercise and interview question. There are a few different solutions to it that work so don't be too worried if yours works but doesn't exactly follow somebody else's.