Modulok wrote:
Notice that 'd' in your string substitution means integers, not
floats. Any decimal places will be truncated when using 'd'. For
floats use 'f' instead. You an also specify a precision, such as
'%.2f' shows two decimal places.
However, to make all of your numbers line up nicely,
"Modulok" wrote
However, to make all of your numbers line up nicely, regardless of
how
long they are, you need to look into advanced string formatting via
the builtin string method 'format()'. It takes a little practice
Or, if your version of Python doesn't support string.format() (pre
2.6
On 3/4/11, lea-par...@bigpond.com wrote:
> Hello
>
> I have created the following code but would like the program to include two
> decimal places in the amounts displayed to the user. How can I add this?
>
> My code:
>
>
> # Ask user to enter purchase price
> purchasePrice = input ('Enter purchase
HelloI have created the following code but would like the program to include two decimal places in the amounts displayed to the user. How can I add this?My code:# Ask user to enter purchase pricepurchasePrice = input ('Enter purchase amount and then press the enter key $')
# Tax ratesstateTaxRate =