Questions about the specifics of strings

Hi guys,

I’m currently stuck at sub exercise 2. which states

Outside of the function, call repeat_stuff .

You can use the value "Row " for stuff and 3 for num_repeats .

what does that translate into python ?

I can’t seem to get it to greenlight it to move to step 3.

17 Likes

Make sure you put the space behind “Row” so that it is "Row ".

19 Likes

Make sure your code is not indented two spaces for this line:

repeat_stuff("Row ", 3)

4 Likes

Hey, thanks for the help!

2 Likes

I’m having a hard time figuring out I am doing wrong here.

Number 5

1 Like

Capitalize B in boat?

2 Likes

I had the same problem, I tried all the code combinations possible, but it didn’t allow me to continue the exercise…

1 Like

def repeat_stuff(str(stuff), num_repeats):
print(’’)

repeat_stuff(“Row”, 3)

What am I missing? it won’t green light it
I’ve tried using str() in multiple ways to no effect
The solution only gives me the completed exercise, but all I want help with is this task
I’ve tried the space thing, but no effect
Thanks for your help

1 Like

you just print an empty string:

print('')

why?

cant get past section 5

def repeat_stuff(stuff, num_repeats=10):
return stuff*num_repeats

lyrics = repeat_stuff("Row " , 3) + "Your Boat "

i get Expected lyrics to equal "Row Row Row Your Boat. "

4 Likes

Is the trailing whitespace expected?

I want to add in, that the exact wording and spaces in each string are important, and "Row" is not the same as "Row ".

1 Like

Its ment to be 'Row ’ with the space at the end

1 Like

Can anyone explain why “Row” gives you an error but "Row " with a space at the end works? I see that the missing space was my error, but I don’t understand why.

2 Likes

THIS! I had the same problem and adding a space behind “Row” so that it read "Row " fixed the issue… But I don’t know why. Why is it important to include the space?

1 Like

Oh! @jcarbs3 I think I figured it out. In the exercise directions it specifies:

"Outside of the function, call repeat_stuff .

You can use the value "Row " for stuff and 3 for num_repeats ."

If you look closely, the directions show "Row " with the space and I guess the answer must match the solution exactly for it to work. I assume they could have written the directions without the space and then “Row” would have worked just fine.

anyone managed to do it ? i tried EVERYTHING and it s not working…
code :

def repeat_stuff (stuff,num_repeats):
print ()

repeat_stuff ("Row ",3)

1 Like

Where are the parameters used? An empty print statement will only output a blank line.

1 Like

i know that it’s empty. it is supposed to be like that in this exercise.

Which step are you on? Also, please post the URL to this exercise in your reply.