Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Print "hi"

Martin Bornman
PLUS
Martin Bornman
Courses Plus Student 12,662 Points

Again what is wrong with this code?

Can someone please help me with this??

printer.py
def printer(count):
  print("Hi ") * 3

printer(count)

1 Answer

Hi Martin,

Your code isn't doing anything with the count parameter that it takes. Additionally, while you can multiply a String, you can't multiply the print() method. So you'd want to enclose the multiplication inside the print() method, and make it multiply by the parameter count instead of hardcoding the multiplication to 3.

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

#  To call your method;
printer(3)