+ 2
How to print a float no i.e. 56.0 as 56.00 , 26.5 as 26.50 and 53.45 as 53.45 in python 3
3 Antworten
+ 6
f = 26.5
print('%.2f' % f)
+ 3
Here’s a working example for you. The key is Decimal(n).quantize(Decimal(‘1.00’))
https://code.sololearn.com/c66pEm5ok79I/?ref=app
0
it has hackerRank