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"

Rusty Flick
Rusty Flick
1,099 Points

I watched your video over and over again and I still don't understand how complete the (print "Hi") challenge correctly.

I dont' know what it means to take a single argument and print "Hi " as many times as the argument. Can someone better explain how to do this?

printer.py

2 Answers

Lisa Pitts
Lisa Pitts
3,249 Points

Hi Rusty,

I just completed this one a minute ago! I'm brand new and just learning, so this may not be a "professional" answer, but I first wrote out the function and named it count, like this def printer(count): and then when you write out print, in the parentheses you can put in "Hi" and use the * symbol to multiply by count. I just typed the word "count" in after the multiply symbol, without the quotes though.

If you want to type what you've done, I could look at it more.

Moderator Edited: Moved response from a Comment to an Answer, so it may possibly be up-voted and/or marked as Best Answer

Steven Parker
Steven Parker
221,438 Points

It doesn't look like you've written any code yet. You should at least give it a "good faith" attempt before giving up.

The challenge itself gave a hint about how to "multiply" a string, and Lisa rephrased it for you.

If you're not sure how to build a function at all, you may want to review this video, particularly from time index 1:30.

Rusty Flick
Rusty Flick
1,099 Points

I have written some code. I've been messing around with it for about an hour. Perhaps I didn't "save".