+ 1
What does it means ( " " ) ? Does it gives the space between 2 words
def my_function(fname, lname): print(fname + " " + lname) my_function("Emil", "Refsnes") Output. Emil Refsnes
4 Réponses
+ 3
Nick ,
there is also a way to get the same result, where we can omit the concatenation of a space:
...
print(fname, lname)
by using the comma notation, the arguments in the print(..., ...) function are displayed with a space inbetween.
an other advantage of this notation is that we can also use, output and combine string literals and numerical values without convert them to string.
fname = 'tom'
lname = 'smith'
age = 34
print(fname, lname, age)
# output=> tom smith 34
+ 2
Yes that’s correct.
+ 1
Thanks
+ 1
Wow! Thanks. Happy, Merry Christmas