0
What does {:.{}f} do?
X = 100.1205 Y = str(X)[6] print('{:.{}f}'.format(X,Y) #100
2 Respostas
+ 5
The outer pair of {} refers to X, the inner pair refers to Y. Y = str(X)[6] = 0, so it's the same as {:.0f} which means "show the number with 0 decimal places"
0
Thanks! Anna