I want to display:
49 as 49.00
49
49.00
and:
54.9 as 54.90
54.9
54.90
Regardless of the length of the decimal
The Easiest way example to show you how to do that is :
Code :
>>> points = 19.5 >>> total = 22 >>>'Correct answers: {:.2%}'.format(points/total) `
>>> points = 19.5
>>> total = 22
>>>'Correct answers: {:.2%}'.format(points/total)
Output : Correct answers: 88.64%