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"

Write a function named printer. The function should take a single argument, count, and should print "Hi " as many times

I dont know how to mutiply the string and integer and print the data

2 Answers

If you need an explanation of this let me know

def printer(count):
    print("Hi " * count) 
James Joseph
James Joseph
4,885 Points

john larson could you explain this to me? I think it makes sense but I just want to understand why to be sure? Or anyone for that matter.

the string, "hi" is multiplied by whatever number is passed in to the count var. I'm happy to discuss it further if that doesn't address your question :D

James Joseph
James Joseph
4,885 Points

@john larson, thanks that makes sense.