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 Comparison Solution

My Solution.

https://w.trhou.se/mpiebxzscp

I did get halfway but then went wrong and started again, is this ok.
Plus I don't quite understand the last TODOs.

TODO: Define variables for is_fizz and is_buzz that stores

a Boolean value of the condition. Remember that the modulo operator, %,

can be used to check if there is a remainder.

Using the variables, check the condition of the value, and print the necessary

string

1 Answer

The code in lines 11 to 22 satisfies the conditions in the TODOs in lines 24 to 31.

The TODO in lines 34 to 36 is asking you to define two variables, is_fizz and is_buzz, with the respective values of number % 3 == 0 and number % 5 == 0.

The TODO in lines 39 to 40 is asking you to replace the conditions in the code from 11 to 22 with the variables is_fizz and is_buzz. For example, line 11 would become if is_fizz and is_buzz:

If name is jas0n and number is 0, line 9, print("Hello{}!".format(name)), ("The number {}..." .format(number)), will print Hellojas0n! and also return (None, 'The number 0...'). To print both the name and the number, try moving the closing parenthesis of the print statement from before the , to the end of the line: print("Hello{}!".format(name), ("The number {}..." .format(number))), which will then print out Hellojas0n! The number 0... all on one line. The TODO in lines 6 to 7 indicates that the statements should be separated by a line separator instead of the default space. You can change the separator to a new line character by adding sep="\n" as an argument to the print statement, such as print("Hello{}!".format(name), ("The number {}..." .format(number)), sep="\n") Alternately, you could use two print statements,

print("Hello{}!".format(name))
print("The number {}..." .format(number))

since print statements end with a new line by default.