-I understand that in line 1 we are defining a function with 2 arguments.
Line 2 we are returning the value so that we can use the arguments outside the function (maybe in it too?).
-Line 3 is where you lose me. You are calling the function inside a variable using its arguments?
-Line 4 I am lost. Youre calling the function again within a variable but instead of an argument you are calling the previous variable? Why do you not need 2 arguments since the functioned is defined with 2 to begin with?
I’m having trouble with step 3 for this one.
I don’t understand how to return the function.
I am doing this: return stuff*num_repeats
it just won’t work for me
What i don’t get here is why if i’ve setted the default value of repeats_num to 10, then if i’d call the function with parameters ("Row ", 3) i’d have a printed output of only 3 Row (Row, Row, Row) and not 10 Row, or 10*3 Row.
I Mean, what’s the use to specify the default value of an argument then? Why it isn’t take in consideration when i call the function?
But then, in the next step, if i create a variable song = repeat_stuff(lyrics)
Where the parameters where specified to be ("Row ", 3), i actually have ten times the string “Row Row Row Your Boat”.
So can i assume that default value of a parameter in a function still is in count somehow?
Can you explain to me this, with some other words please?
I Mean, i saw how it works, but i must say that it also has created a little bug in my understanding
Thanks well, its more of the little things that one has to remember. I had lyrics indented which gave me and error " Expected lyrics to be defined", Sorted thanks
The solution you are posting is what makes no sense. It clearly does not follow the rather explicit instructions of what to actually do, for this step…
Define a function called repeat_stuff that takes in two inputs, stuff , and num_repeats .
We will want to make this function print a string with stuff repeated num_repeats amount of times. For now, only put an empty print statement inside the function.
def repeat_stuff(stuff, num_repeats):
print ()
THAT is all we are directed to do. As to the final question above, that is rather moot, in light of things.