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 trialDenis Ts
2,751 PointsHi , Please advise The challenge is to print "Hi" ( x times) as amount of function argument. in shell it works fine.
i have tried also to convert the argument to "int" ( just in case ) (also works fine in shell)
def printer(count): a = int(count) print ("hi ") * a
printer(5)
But still getting the same Can someone please suggest what's wrong here ?
def printer(count):
print("Hi ") * count
printer(5)
2 Answers
James J. McCombie
Python Web Development Techdegree Graduate 21,199 Pointsdef printer(count):
print("Hi" * count)
in your code you also have "Hi " which will come out like Hi Hi Hi Hi Hi, not HiHiHiHiHi, but that may be what is needed in the challenge I cant remember
Jason Anders
Treehouse Moderator 145,860 PointsHey Denis.
You've almost got it, but there are just a couple of small things.
- The count variable needs to be included inside of the parenthesis for the
print
statement. - The challenge didn't ask you to call the function... just write it.
def printer(count):
print("Hi " * count)
Keep Coding! :)