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 trialDebdipta Dasgupta
431 PointsHow to solve this function
Can't get through this code challenge.Can't understand what the question is asking to do here
def printer(count):
print("Hi")
printer(5)
2 Answers
TEST_ID = L M_TEST
2,238 PointsYou have to make a function named printer that takes count as an argument and prints "Hi " as many times as the count argument
def printer(count):
while count != 0:
print("Hi ")
count -= 1
lambda
12,556 PointsThe challenge is asking you to print "Hi" count number of times.
For example, printer(5) should print "Hi Hi Hi Hi Hi". Your code only prints "Hi " regardless what count you pass in.
You can use a loop like Levan Mebonia suggested or you can use python's * operator.
Debdipta Dasgupta
431 PointsThanks
Debdipta Dasgupta
431 PointsDebdipta Dasgupta
431 PointsThank you so much