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 trialSean Frye
1,167 PointsI honestly have no idea what I'm doing!
I watched the whole video and I looked back at what I typed in Workspaces and I honestly don't understand what they are telling me to do. It's confusing me and with all the times I keep asking for help, I'm getting more and more discouraged. I want to take the next step forward, but it's getting so hard. I don't understand what I'm supposed to do!
def printer(count):
print("Hi {} friend.".format(count))
printer("1")
1 Answer
Calin Bogdan
14,921 PointsHello!
We've all been there, struggling to understand how to succeed when learning to code. As all things, it takes patience and persistence.
The main challenge here is using the little tricky thing that lets you multiply strings (string * the number of times to be displayed). You have to define a function that prints "Hi " as many times as the count parameter says. Therefore, there's no need to use the .format() function there.
Remember the syntax, as stated in the video:
my_name = "Calin"
my_name_five_times = my_name * 5
//print(my_name_five_times) will show "CalinCalinCalinCalinCalin"
You can do this with "Hi " as well. Also, remember that the count parameter has to be an int. You're currently passing a string with a number.
Don't get disheartened here. I'm sure you'll finally work it out!
Sean Frye
1,167 PointsSean Frye
1,167 PointsI probably should have deleted my message. A little after posting this, I figured it out.