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!
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
Jonathan Caver2,222 Points
I have run the following code in the Workspace, and it works when I put a number in for count. What's wrong?
I have run the following code in the Workspace, and it works when I put a number in for count. What's wrong? Thanks.
def printer(count): return count * "Hi " print(printer(count))
Jason AndersTreehouse Moderator 145,826 Points
For the challenge, it just wants you to create the function, which you did (has a couple errors though), but you also called the function, and the challenge did not want that. So first off, you need to delete the function call.
Challenges are very specific and picky. In the function it asked you to create, it wants you to
With that said,
def printer(count): print (count * "Hi ")
To touch on your other point about working in Workspaces when you pass in a number, when you call a function, you have to pass in a value. The
count variable is a 'placeholder' when you create the function, but when you call it, it need an actual value passed in.
So, you really are on the right track. Keep Coding! :)
Zixu Zhao365 Points
Zixu Zhao365 Points
This question is a little confusing...actually, I can't understand what this question is asking for. By the way, it seems like the function we defined has nothing to do with the print, is that why we don't need to call the function? If we don't call the function, does that mean we don't use the function at all? Then why we still define it?