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"

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
230,274 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".