This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:round [2020/04/21 21:25] admin |
en:round [2020/04/21 21:26] (current) admin [Description] |
||
---|---|---|---|
Line 11: | Line 11: | ||
==== Description ==== | ==== Description ==== | ||
- | This function rounds a floating point number. | + | This function rounds a floating point number. |
==== Example ==== | ==== Example ==== | ||
Line 24: | Line 24: | ||
</ | </ | ||
< | < | ||
- | a = 3.1415926535 | + | 3.0 |
- | print round(a) | + | 3.1 |
- | print round(a,1) | + | 3.14 |
- | print round(a,2) | + | 3.142 |
- | print round(a,3) | + | 3.1416 |
- | print round(a,4) | + | |
</ | </ | ||