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 Python Basics (2015) Logic in Python Print "hi"

Help with the Challenge Task of the Fully Functional module for the Python Basics training?

Instruction states: "Write a function named printer. The function should take a single argument, count, and should print "Hi " as many times as the count argument. Remember, you can multiply by a string integer."

I understand how to define the function and write the code to print "Hi" but am received the same error over and over that, "Bummer! Didn't find the right number of "Hi"s."

The hint is to multiply the "Hi" string by an integer, but each attempt I make results in the same error. What am I not doing that will achieve the desired result?

Any solution assistance would be appreciated.

printer.py
def printer(count):
    print("Hi ")

1 Answer

You have your printer() and it is taking count. Your print statement will print the specified string but what is missing is the logic to connect your print to count. We know that the variable count really just represents a unspecified integer, so you should connect your printing to whatever value count could be holding so you get that many prints.