Python Tutorial Help

def repeat_stuff(stuff,num_repeats=10):
return stuff*num_repeats
lyrics= (repeat_stuff("Row ", 3) + "Your Boat. ")
song=repeat_stuff(lyrics)
print(song)

Why is the output this:
Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat.

Instead of this:
Row Row Row Your Boat. Row Row Row Your Boat. Row Row Row Your Boat.

I thought the default didn’t get used unless there was only one input in the function repeat_stuff.
Please explain!

absolutely true, but here:

song=repeat_stuff(lyrics)

there is only one argument (or input as you name it) to function call, so the default (10) gets used

this program uses the repeat_stuff function twice: once to make the lyrics and once to make the song.

1 Like

Wow, I see that now. :smile: Thanks for the speedy response!

Fine and good in this instance. One should not rely upon such support, going forward. Ask a lot a questions of the same responder and you may as well be them. Spread your own wings.

I see your point but I disagree. I prefer to ask too many questions than to ask too little. It seems to make the learning process go by faster. However, if learning code is dissimilar to learning stuff in school, id be more than willing to change.