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"

Lewis Mansbridge
Lewis Mansbridge
1,119 Points

Hi there, i thought my understanding was goin well on this but maybe not, please can i have some help thanks

Hi there, i thought my understanding was goin well on this but maybe not, please can i have some help thanks

printer.py
def printer(count):
    if count >= 0:
        print("Hi " * count)
        count -= 1

count = 5
printer()

2 Answers

Lewis Mansbridge
Lewis Mansbridge
1,119 Points

I didnt mean to put the * count in the print bit that was me experimenting

Vlad Dyagilev
Vlad Dyagilev
9,625 Points

You called the printer function without the variable inside the brackets. To do you would need to call printer(count). Also your printer function is incorrect. All you needed to do was write print("Hi " * count)