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 trialFilip Stan
Courses Plus Student 621 PointsI don't understand what i have to do(what is my task).
I don't understand what i have to do(what is my task).
2 Answers
Aayush Mitra
24,904 PointsHi Filip!
In the question it is asking you to define a function called printer and takes in an argument called count.
def printer(count):
Next it says to print "Hi" as many times the count is. This will need a for loop. We will say:
for i in range(count):
This will execute the code that is in this for block as many times the count is.
Now all we need to do is tell it to print "Hi" in the for loop.
The final version of the code should look like this:
def printer(count):
for i in range(count):
print("Hi")
Hope this helps.
If it does not work please let me know.
Thanks. :)
Luke Strama
6,928 PointsThe task is asking for you to create a function where you take in 'count' as a parameter. Count will be a number, say 5, and then it will show Hi 5 times.
So basically:
>>>printer(5)
Output will be:
HiHiHiHiHi