I found this one to be an odd exercise. I knew while completing it that there were better ways to write the function, but couldn’t think of anything except for the following:
Write your first_three_multiples function here:
def first_three_multiples(num):
print(num, num + num, num + num + num)
return num + num + num
Running this worked and met the requirements to complete this portion of the lesson, but for practical application, how could I write this better? For example, how would I write this function if I wanted to see the first 50 multiples and have it return or print the 27th, 32nd and 50th? My solution above would still work but would require a LOT of "+ num"s. Obviously the better choice is to keep your code as simple and condensed as possible.
I feel silly asking but for some reason I’m not connecting the dots on this one…
You’re completely right, I did mean repeated! My apologies, it was pretty late when I replied to that, didn’t completely get to convey my thoughts haha.
But yeah, the code should still be correct, regardless of my language barrier blunder.
(When I said simplified, I meant less items in code, replying to their question on how to keep code “as simple and condensed as possible.”)
Thanks for the keen eye!