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"

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,280 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.