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"

function help

Can anyone help? I really wish Teamtreehouse would add an option to see the correct code so I don't have to ask every time. I have now had to just skip several quizzes and challenges due to not having the answer and no button to see where I was wrong.

printer.py
count - "Hi"

def printer(): count

print(printer)

1 Answer

Paul Kamarudin
Paul Kamarudin
5,292 Points

Having a look at what you have typed....

count - "Hi"

Usually in these quizzes the first line is going to be defining the function like def printer etc. I would lose this line.

def printer(): count

The variable should be stated within the function parenthesis. You are passing count to the printer function and so this should be within the parenthesis.

print(printer)

Any code that is within the function should then be indented. Within the parenthesis you should be trying to multiply "Hi" by count. This should read something like:

    print("Hi" * count)

Let me know if that helps and if you get this out. Getting a good understanding of the basics is really helpful moving forward.