- 3
Python
You need to write a function that takes multiple words as its argument and returns a concatenated version of those words separated by dashes (-). The function should be able to take a varying number of words as the argument. Sample Input this is great Sample Output this-is-great By python langug
3 Respuestas
+ 6
As already mentioned you need a function to capture all input words. For this you have to define a parameter like "*args" in the function head.
The result in this variable is a tuple, that holds all words as strings separated by comma, To create the output string, you dont need to iterate through this tuple, you just can concatenate the words by using join() function with some modifications.
Happy coding!
+ 4
Mohammed Dafa alla Mohammednour Hamid Show your attempts.
Duplicate?
https://www.sololearn.com/Discuss/2640339/?ref=app
+ 3
Your function will have one param : args for example.args is a tuple of input.To iterate throw the args elements you can use for loop to tell the interpreter that it have to iterate throw the args elements in args.example for arg in args: Then you can code the return value from what the for loop will give us.