Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Print "hi"

I must not know what they're asking..

So it works in eclipse, and I must say I am very happy about the bit of code I wrote.

Earlier I had similar code that required me to use a number for count, I choose 3 and it worked fine.

What do they want?

3 Answers

Nathan Tallack
Nathan Tallack
22,159 Points

What they are trying to do here is show you that you can multiply strings when using the print function.

So your code could look like this.

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

Take note of the space after the Hi inside the quotation marks. :)

Ah, I guess I was over complicating it then. Thankyou! :)

John Goldring
John Goldring
634 Points

Hi, I have been stuck on this challenge. My code:

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

would not work. Could you briefly tell me why challenge doesn't like it the other way around?