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"

Brandon Jones
Brandon Jones
3,305 Points

Basic Python code error. I'm probably missing something really simple.

I keep getting an error message with this code.

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

Hey Brandon!

I know what you mean, I find myself wondering if I'm missing simple stuff a lot too. But it's important to remember that when learning a whole new language, a lot of 'simple' stuff is actually kind of complex!

With this, try looking a bit closer at the last line of instructions: "Remember, you can multiply a string by an integer."

I think that was put there because this code error is a common error, and I think that may give you a clue as to where to go next. Let me know if I can help more with this.

2 Answers

Tabatha Trahan
Tabatha Trahan
21,422 Points

Take a look at the operator you are using with your string "Hi". You'll want to multiply the string by the value passed in to count to get it to print out the number of times in count.

Brandon Jones
Brandon Jones
3,305 Points

Of course! I completely missed that one. Thanks!