0
what is the meaning of...???
so just learning python but don't understand the inclusion of "$%.2f" in: print('The tax is $%.2f' % totalTax) as opposed to writing: print('The tax is $:', totalTax) they produce different outputs in their use but i need enlightenment, thanks.
6 ответов
+ 1
Its formatting
The .2f makes the number a float with 2 numbers after the decimal
+ 1
% calls in the total tax variable.
The .2f rounds the float to the 2nd decimal point
+ 1
Thanks... explains a lot 😄
0
thanks for the answers 👍🏿
$ = currency symbol
% = calls totalTax
.2f = floats 2places after decimal point.
Just as i figured...
no harm in asking but why use "%" twice?