1-0.95
pecore at pascolo.net
pecore at pascolo.net
Tue Jul 1 19:13:14 EDT 2014
Pedro Izecksohn <izecksohn at yahoo.com> writes:
> pedro at microboard:~$ /usr/bin/python3
> Python 3.3.2+ (default, Feb 28 2014, 00:52:16)
> [GCC 4.8.1] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> 1-0.95
> 0.050000000000000044
>>>>
>
> How to get 0.05 as result?
print("%4.2f"%(1-0.95))
i.e., you can change how a result is displayed, not its internal
representation
More information about the Python-list
mailing list