plz help me in understanding | Sololearn: Learn to code for FREE!
0

plz help me in understanding

what is the role of "%5.2f "in a code? of course, I know about ".2" means decimal point, i want to know the use of %5 before it?

12th Apr 2019, 11:24 AM
Bhaskar Chandra Sahoo
Bhaskar Chandra Sahoo - avatar
3 odpowiedzi
+ 3
5 stands for the total place So for example 12.34 has a length of 5 (dot included) If the number is smaller, e.g 1.23 (length of 4) then the rest is filled with spaces to make it 5 long again in the output.
12th Apr 2019, 12:05 PM
Matthias
Matthias - avatar
12th Apr 2019, 12:25 PM
Ipang
0
Ty
14th Apr 2019, 4:40 PM
Bhaskar Chandra Sahoo
Bhaskar Chandra Sahoo - avatar