>>> ucal(1, 2) 0 >>> ucal(1.1, 2) 0.11000000000000011 >>> ucal(1.2, 2) 0.23999999999999994
(u: float, p: int)
| 6 | |
| 7 | # for calculating u value |
| 8 | def ucal(u: float, p: int) -> float: |
| 9 | """ |
| 10 | >>> ucal(1, 2) |
| 11 | 0 |
| 12 | >>> ucal(1.1, 2) |
| 13 | 0.11000000000000011 |
| 14 | >>> ucal(1.2, 2) |
| 15 | 0.23999999999999994 |
| 16 | """ |
| 17 | temp = u |
| 18 | for i in range(1, p): |
| 19 | temp = temp * (u - i) |
| 20 | return temp |
| 21 | |
| 22 | |
| 23 | def main() -> None: |