0

Can someone help me solve the adding words problem this is wat I got so far

def concatenate(*args): for arg in args: print(arg+"-") print(concatenate("I", "love", "Python", "!"))

2nd Nov 2020, 3:15 PM
Obinna Ihekaibe
Obinna Ihekaibe - avatar
5 Réponses
+ 4
Something like this ? def concatenate(*args): return "-".join(args)
2nd Nov 2020, 3:19 PM
Szwendacz
Szwendacz - avatar
+ 2
If you want to keep the last line your function has to return the concatenated string: def concatenate(*args): return "-".join(args)
2nd Nov 2020, 3:24 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 1
If you don't want to use "join", here is an alternate solution using native loop. https://code.sololearn.com/c1CqwQVKc6U6/?ref=app
15th Dec 2020, 7:43 PM
Lam Wei Li
Lam Wei Li - avatar
0
Thanks guys
2nd Nov 2020, 3:24 PM
Obinna Ihekaibe
Obinna Ihekaibe - avatar