Pyhton Functions

While defining functions and creating the parameters and what to return i noticed a lot of questions throughout the curriculum were asking for returning values with whitespace or spaces after some of the arguments. I struggled to figure out how to write whitespace into my python functions until i was adding a blank string into the middle of the paramaters am i correct in doing it in such a way or is there an easier method?
this is my first time posting here so i am a little uncertain how to show my code on here but the question i am referring to was about returning last_name, first_name (Space) last_name. I continued to have returns of bond jamesbond without the space until i did return " " with a white space in the middle of the paramater. Would someone who is not a brand new wide eyed coder enlighten me and save me 1000 future headaches.
Any other tips and pointers i should know when diving into python i would greatly appreciate. Cheers

To post formatted code: use the “< \ >” button.

1 Like

It sounds like the return value is to be a single string object. Have you learned about string interpolation?

return f"{first_name} {last_name}"

Read up on f-string formatting, as well as the other legacy methods.

1 Like

Thank you for your response, I look for your responses on most of the questions i have that people ask! I have not reached F-string formatting yet. I did a little HTML and CSS before starting python. If you have a better stepping stone to start on i would definitely take any advice. and the return was not a single string they had me defining a function example(first_name, last_name):
and wanting the outcome to be

Bond, James Bond and i couldn’t get the James Bond to be spaced apart without a comma. Without writing in a " "empty space . But i will do a little reading today on what you brought up! I appreciate the quick responses!

1 Like