New course! Every coder should learn Generative AI!
Try a free lesson+ 5
The function concatenate() is called with a some strings as arguments. The function outputs the joined list, but does not return explicitly a value. In such cases None is returned. As the function call is done with an embracing print(), the returned value None is printed.
To get rid of this, just omit the print() when the function is called.
0
Bcs the function concatenate is not returning anything. The last line has a print statement and it is waiting for the function to return
There are 2 solves
METHOD 1:
list = []
def concatenate(*args):
for word in args:
list.append(word)
print("-".join(list))
concatenate("I", "love", "Python", "!")
Method 2:
list = []
def concatenate(*args):
for word in args:
list.append(word)
return "-".join(list)
print(concatenate("I", "love", "Python", "!"))
I havent run this, but this must work