String operation

Can we use mixtures of named and position variables in the format function?
" {},{},{lastname}, {}".format(a,b,c,lastname=‘123’.

Hey @Akshay986, yes you can use the following syntax inside print statements :

 print("{},{},{lastname},{}".format('a','b','c',lastname='Sharma'))

Just remember one thing : Keyword arguments come at the end after positional arguments

Hope this helps !
Happy Learning :slight_smile:

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.