- 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

25th Dec 2020, 6:13 PM
Mohammed Dafa alla Mohammednour Hamid
Mohammed Dafa alla Mohammednour Hamid - avatar
3 odpowiedzi
+ 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!
25th Dec 2020, 8:54 PM
Lothar
Lothar - avatar
25th Dec 2020, 6:27 PM
A͢J
A͢J - avatar
+ 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.
25th Dec 2020, 6:43 PM
HBhZ_C
HBhZ_C - avatar