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 trialJuan Prada
4,429 Pointsprint "hi"
so i managed to get this far
def printer (count): print("hi ")
but im not sure what the question is asking
1 Answer
Ryan S
27,276 PointsHi Juan,
The question is asking you to write a function that takes an argument named "count" and prints the word "Hi " as many times as whatever the "count" variable is equal to.
So if count = 5, it would print Hi Hi Hi Hi Hi.
You can multiply a string by an integer inside a print() function:
def printer(count):
print("Hi " * count)
Ryan S
27,276 PointsOh I see Cheo responded while I was typing out my answer! I should've refreshed the page. Anyways, he has a good explanation.
Cheo R
37,150 PointsCheo R
37,150 PointsHello Juan, you're on the right track.
The prompt is asking to write a function, that when you pass it an argument (a number), your function will print "Hi " that many times. For example
You're on the right track, all you need to do is to multiply the string by the argument, so your code:
def printer (count): print("hi ")
should be