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"

Ryan Sladek
Ryan Sladek
427 Points

How to find the right number of "Hi's"

I think I am having a problem figuring out how to get this code to loop. With the code I have right now my error message says "The number of "Hi's" is not specified.

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

1 Answer

Keifer Joedicker
Keifer Joedicker
5,869 Points

Look at the count argument as an alias for the number that will pass through when the function is called.

Your code is a template for how that function's alias will be manipulated.

The number passed through will be used to return a new string with "Hi" repeated count amount of times.

so the template to follow in order to return the desired outcome is ("Hi" * count):


"Hi " * 1 = "Hi "


"Hi " * 2 = "Hi Hi "


"Hi " * 3 = "Hi Hi Hi "

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

("Hi" * count) = Hi Hi Hi Hi Hi (Does count mean (multiply by 5?))