I am learning python. Written two tiny programs. Can’t understand the output difference /u/FewNectarine623 Python Education

1)def name(fname, mname, lname):

return “Hello, ” + fname + ” ” + mname + ” ” + lname

print(name(“James”, “Buchanan”, “Barnes”))

output – Hello, James Buchanan Barnes

2)def name(fname,mname,lname):

return “Hello,”+fname,mname,lname

print(name(“Joe”,”Peter”,”Quill”))

(‘Hello,Joe’, ‘Peter’, ‘Quill’)

please explain the output of second ? why is it in a tuple . When in the return statement I remove all commas with + the parentheses go way?

submitted by /u/FewNectarine623
[link] [comments]

​r/learnpython 1)def name(fname, mname, lname): return “Hello, ” + fname + ” ” + mname + ” ” + lname print(name(“James”, “Buchanan”, “Barnes”)) output – Hello, James Buchanan Barnes 2)def name(fname,mname,lname): return “Hello,”+fname,mname,lname print(name(“Joe”,”Peter”,”Quill”)) (‘Hello,Joe’, ‘Peter’, ‘Quill’) please explain the output of second ? why is it in a tuple . When in the return statement I remove all commas with + the parentheses go way? submitted by /u/FewNectarine623 [link] [comments] 

1)def name(fname, mname, lname):

return “Hello, ” + fname + ” ” + mname + ” ” + lname

print(name(“James”, “Buchanan”, “Barnes”))

output – Hello, James Buchanan Barnes

2)def name(fname,mname,lname):

return “Hello,”+fname,mname,lname

print(name(“Joe”,”Peter”,”Quill”))

(‘Hello,Joe’, ‘Peter’, ‘Quill’)

please explain the output of second ? why is it in a tuple . When in the return statement I remove all commas with + the parentheses go way?

submitted by /u/FewNectarine623
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *