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"

or porat
or porat
684 Points

struggling in that question

Hey! I didn't realize what is the function and when i need to use 'def'. also, i can't pass this question because i didnt understood what to do exacly. can someone help me please? thanx!

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

2 Answers

A function is a bit of code that is held together in a code block under a name and can be run repeatedly. def needs to be before the name of each function. I hope that helps a little bit.

To pass this challenge you just need to multiply "Hi " by count. You've got everything else done.

def printer(count):
    print("Hi " * count)
or porat
or porat
684 Points

thanx!!

Thomas Fildes
Thomas Fildes
22,687 Points

Hi there,

def printer(count): # printer is the function name and count is the argument in parenthesis
    print("Hi " * count) # this the function's code block and actions it takes (in this example it will multiply the string "Hi " with the argument count 

Hope this helps! Happy Coding!

or porat
or porat
684 Points

thanx!!