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"

Ed B
PLUS
Ed B
Courses Plus Student 3,973 Points

Trouble running code in for Python Challenge. Runs in Python IDE but not Treehouse.

My code for this challenge task runs fine in a Python IDE but I get the Bummer message for the Treehouse Challenge. It never asks me for input, so maybe I'm not understanding how the Treehouse editor works.

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

count = int(input("Enter a number: "))
printer(count)

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing really well here. But you need to understand this about challenges. They're going to call your function and they're going to send in a number for count. Possibly multiple times. So the last 2 lines are negating what they're sending into your code. If you erase the last two lines, your code passes! Hope this helps! :sparkles:

Steven Parker
Steven Parker
231,271 Points

Remember that the challenges aren't just about making code "run". The code needs to accomplish a specific objective — and nothing else.

Experiment with doing things different ways and adding extra functionality in the workspace, but in the challenges follow the instructions and keep it simple.