Create solution.md
Browse files- evaluation/solution.md +13 -0
evaluation/solution.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```python
|
| 2 |
+
|
| 3 |
+
def truncate_number(number: float) -> float:
|
| 4 |
+
""" Given a positive floating point number, it can be decomposed into
|
| 5 |
+
and integer part (largest integer smaller than given number) and decimals
|
| 6 |
+
(leftover part always smaller than 1).
|
| 7 |
+
|
| 8 |
+
Return the decimal part of the number.
|
| 9 |
+
>>> truncate_number(3.5)
|
| 10 |
+
0.5
|
| 11 |
+
"""
|
| 12 |
+
return number % 1
|
| 13 |
+
```
|