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"

Nuzul Hafizi Mohd Arif
Nuzul Hafizi Mohd Arif
556 Points

def printer(count): print("Hi {}".format(count)*10) printer('')

output: Hi Hi Hi Hi Hi Hi Hi Hi Hi Hi

but still wrong.

printer.py
def printer(count):
    print("Hi {}".format(count)*10)

printer('')

You don't need to call the function printer in the challenge. Also, you don't need to print count with Hi. Your code should look like this:

def printer(count):
      print('Hi' * count)

Hope this helps!

1 Answer

Steven Parker
Steven Parker
231,271 Points

The instructions say that the function "should print "Hi " as many times as the count argument".

But the code here always prints 10 times, and prints the argument as part of the output. So if the challenge were to test it by calling "printer(5)" the output would be: "Hi 5Hi 5Hi 5Hi 5Hi 5Hi 5Hi 5Hi 5Hi 5Hi 5".