python string format ques two | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

python string format ques two

can anyone help me I got abra part right but not the rest thanks Shad

17th Aug 2017, 8:37 PM
Shad Schorling
Shad Schorling - avatar
1 Answer
0
It's the simplest among the two ways. You could put something as a keyword in your string " put a keyword {a} curly brackets and pass your object for that {pos} through the keyword in string formatting. ".format(a='in' , pos ='position') you could use a combination of positional arguments and keyword arguments , but make sure to mention the positional arguments first in the string formatting . .format(3,'eggs',x=sum) - correct .format (3,x=sum,'eggs') - incorrect hope this helps
26th Aug 2017, 5:20 PM
Ahamed Shibili
Ahamed Shibili - avatar