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"

Jamaru Rodgers
Jamaru Rodgers
3,046 Points

Function parameters

I'm not understanding why the function isn't printing, and it's really getting annoying because I can't figure these out on my own. I'm not learning from them, I keep finding myself passing them just to get to the next step. Someone please help me figure this out? I know I'm doing something terribly wrong and I can't catch it..

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

printer(1)

1 Answer

Hi Jamal,

You will want to multiply "hi" by count in the print statement or set it to a variable and then print the variable. Currently you have it so that it will only print('hi'). Your code is doing nothin with the " 'hi' * 50 ". Here is what I am talking about:

def printer(count):
    print("Hi" * count)
Jamaru Rodgers
Jamaru Rodgers
3,046 Points

That was so simple... Thank you. If you don't mind me asking, how did you get started coding, and how long will it take me to be proficient in Python? I can't take the level of knowledge I'm at right now..

No problem. I bought a few books on python a week ago. The first one was about creating and cracking cyphers using python, so it made it very interesting and explained the material pretty well. There is also a free book online ("Automate the Boring Things" I think) that helps you understand Python with real world examples of what you can do to help with everyday tasks. I also watched some videos from pythongprogramming.net. Classes have slowed down just before finals, so I had some free time on my hands lol. After all that, I signed up for teamtreehouse.com. I like their teaching style, and it is really reinforcing a lot of the material. It's also shown me several things that the other sources didn't talk about. With enough practice, you'll be proficient in Python in no time! If you get stuck, don't worry about it. There are a lot of people that will help you. I learned the basics of a few programming languages through reading textbooks in my free time or taking classes, so this helped me understand a lot of the concepts quickly. Once you learn your first language, other languages can come quicker (my guess is there are several variables such as how similar the languages are).