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 Task

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.

Please help me in this Python task

5 Answers

Lets break it down!

"Write a function named printer"

def printer():

"The function should take a single argument, count."

def printer(count):

Arguments are spots for data that can be passed through a function. Argument names are sort of like aliases for data coming through, and with these aliases you can make a template for how you would like the data to travel so when a function initializes the data passed through each argument then gets manipulated according to your code.

When the final set of instructions says:

"should print "Hi " as many times as the count argument". Your going to make a template for how the function will manipulate the given data passed through the argument.

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

Hey Keifer! I got a question! Can I ask you?

Thanks a lot Keifer! Hats off to you!!

Hi Keifer! Would you mind if I can ask you one more question?

Sure, what's your question?

Oh sorry! My problem got solved. Thanks for your previous help and your response.

So I have run this code in my terminal and it works great but in the coding challenge I keep getting a error message that says "Bummer! Didn't find the right number of "Hi"s." I don't see anywhere on here that tells me how many "hi's" to make it print out.... not sure what to do... any suggestions?