Hw do u write afunction that takes multiple words as itsarguments& returns a concatenated version of those words separated by(-) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hw do u write afunction that takes multiple words as itsarguments& returns a concatenated version of those words separated by(-)

The function should be able to take a varying number of words as its argument Sample input This is me Sample output This-is-me

28th Jan 2021, 2:19 PM
simbarashe
8 Answers
+ 3
This is one of the python challenges, right? Please post your attempt, so we can help you!
28th Jan 2021, 2:21 PM
Lisa
Lisa - avatar
+ 2
Rachel Witro It a end of module project in the sololearn python course (104
28th Jan 2021, 2:24 PM
Lisa
Lisa - avatar
+ 2
https://code.sololearn.com/c60fgG8OHpAx/?ref=app Analyze this code! This will help you! All the best!
28th Jan 2021, 2:45 PM
Abhiyantā
Abhiyantā - avatar
+ 1
simbarashe join() can help you "-".join(words) # no loop needed
28th Jan 2021, 2:31 PM
Lisa
Lisa - avatar
+ 1
Ok thank you
28th Jan 2021, 2:34 PM
simbarashe
+ 1
If the words are already assigned then the code is a bit easy (I think) print('simbarshe', 'does', 'coding', sep = '-') Happy Coding
29th Jan 2021, 12:05 PM
∆BH∆Y
∆BH∆Y - avatar
0
But u guys where do u get your challenges from
28th Jan 2021, 2:23 PM
Rachel Witro
Rachel Witro - avatar
0
def show (*words): for word in words: print(word) show('this','is','me') So i want it to give an ouput like this-is-me ,so can u assist me
28th Jan 2021, 2:28 PM
simbarashe