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 trialArilesere Olaseni
417 Pointsprinter.py
I got stucked
def printer(count): if count == 3: print( "Hi", "Hi", "Hi") count = 3
Please where is the mistake.
def printer (count):
if count == 2:
print ("Hi","Hi")
count = 2
4 Answers
Keith Whatling
17,759 PointsIs there a space round the hi? if so ammend and it should pass, I tested the code.
Keith Whatling
17,759 PointsThe clue and answer is in the question.
" Remember, you can multiply a string by an integer."
Kenneth is saying that you can simply multiply "Hi" by the argument (an integer) that you are passing into the function.
so "hi" X some number say 3 will print "HiHiHi"
def printer(arg):
print("Hi" * arg)
Its super important to read the question as this what a lot of coding is about, finding the right answer to a question, pulling apart the question will help you write your algorithms and become an amazing coder!
Keep going you are doing great!
Arilesere Olaseni
417 PointsThanks for the assistance but still it didn't work.
def printer (count): if count == 100: print ("Hi " * 100 )
Arilesere Olaseni
417 PointsThanks for the assistance once again. Unfortunately, i don't know what i have been dong wrongly because i'm yet to progress from this point. I think this is my exact code def printer (count): if count == 3: print ("Hi"*3)
Just that it aint working and i even tried it on spyder and not running too.