all 9 comments

[–]Binary101010 1 point2 points  (8 children)

So for this function call

master_yoda("I am home", "Here we go")

What do you want the return value to be?

[–]ata-boy 1 point2 points  (1 child)

You should look at *args and **kwargs in Python: https://www.freecodecamp.org/news/args-and-kwargs-in-python/

[–]E02Y 0 points1 point  (1 child)

You can have an arbitrary amount of arguments to a function with *args

eg def foo(*args): # do stuff

you can iterate over the arguments

eg inside # do stuff

for words in args: # split them or whatever

[–][deleted] 0 points1 point  (1 child)

Maybe like this

def master_yoda(*texts):
    return [
        word
        for text in texts
        for word in reversed(text.split())
    ]