Doubt in a concept

Can you tell what will be the syntax of printing 2 parameters. For example:

def function(name,roll_no):

    print("hello {} {}".format(name).format(roll_no)

I don’t know what is its syntax .I want name as well as roll no in the output

Hey @vageesha,
So there are multiple ways to achieve this task, some of them are:-

  1. Hard-coded method: In this way you have to insert the variable by using separator i.e. “,” between sentences.
  2. Formatted string: In this way just type “f” before the string and then put every variable name in curly braces.
  3. .format method: In this way just put curly braces where you want to print variable and then after writing complete sentence write “.format()” and then in bracket write variables in the order you want to insert them in sentence.
    I have coded all three method in this file --> Link

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.