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 trialtwistit
371 Pointsmy first function with argument
Write a function named printer. The function should take a single argument, count, and should print "Hi " as many times as the count argument. Remember, you can multiply a string by an integer.
def printer(count):
print ("Hi"*3)
printer(3)
4 Answers
Jaxon Gonzales
3,562 PointsHey!
All your code is perfect except for one part. The number of times you multiply Hi should be by the argument that the user passes in. For example:
print("Hi"*count)
This would instead multiply Hi by the argument that the user passes in.
Hope this helps!
Philip Collins
13,249 Pointsdef printer(count):
print ("Hi "*count)
printer(3)
Don't get why I'm wrong?
Jaxon Gonzales
3,562 PointsThree recommendations:
- I would recommend not putting a space between a method like print and the parentheses. This can sometime make your code more confusing.
- When you call the printer function in your code it looks like it might have a space before it. If so, that is what is causing the error.
- Next time that you ask a question on the forum, it would help to put the error you are getting. This makes the question more clear and specific.
Happy Coding!
twistit
371 Pointshi jaxon and philip!! thank you for the answer. with your answer i am already moving forward. thanks again.
Philip Collins
13,249 PointsOk, I'm still getting " Bummer! Try again!" error.
def printer(count):
print("Hi "*count)
printer(3)
i have removed the spaces, really don't understand what I'm doing wrong here :/
Andreas Petri
775 PointsHmm.... The code looks right but it seems like you have an extra space in front of when you call the printer function. Try removing it and see if that helps :)