|
10 | 10 |
|
11 | 11 | def calculation_span(price: list[float]): |
12 | 12 | """ |
13 | | - Calculate the span values for a given list of stock prices. |
14 | | - Args: |
15 | | - price (list): List of stock prices. |
16 | | - Returns: |
17 | | - >>> price = [10, 4, 5, 90, 120, 80] |
18 | | - >>> calculation_span(price) |
19 | | - [1, 1, 2, 4, 5, 6] |
20 | | - >>> price = [100, 50, 60, 70, 80, 90] |
21 | | - >>> calculation_span(price) |
22 | | - [1, 1, 2, 3, 4, 5] |
23 | | - >>> price = [5, 4, 3, 2, 1] |
24 | | - >>> calculation_span(price) |
25 | | - [1, 1, 2, 3, 4] |
26 | | - >>> price = [1, 2, 3, 4, 5] |
27 | | - >>> calculation_span(price) |
28 | | - [1, 2, 3, 4, 5] |
29 | | - >>> price = [10, 20, 30, 40, 50] |
30 | | - >>> calculation_span(price) |
31 | | - [1, 2, 3, 4, 5] |
32 | | - """ |
| 13 | + Calculate the span values for a given list of stock prices. |
| 14 | + Args: |
| 15 | + price (list): List of stock prices. |
| 16 | + Returns: |
| 17 | + >>> price = [10, 4, 5, 90, 120, 80] |
| 18 | + >>> calculation_span(price) |
| 19 | + [1, 1, 2, 4, 5, 6] |
| 20 | + >>> price = [100, 50, 60, 70, 80, 90] |
| 21 | + >>> calculation_span(price) |
| 22 | + [1, 1, 2, 3, 4, 5] |
| 23 | + >>> price = [5, 4, 3, 2, 1] |
| 24 | + >>> calculation_span(price) |
| 25 | + [1, 1, 2, 3, 4] |
| 26 | + >>> price = [1, 2, 3, 4, 5] |
| 27 | + >>> calculation_span(price) |
| 28 | + [1, 2, 3, 4, 5] |
| 29 | + >>> price = [10, 20, 30, 40, 50] |
| 30 | + >>> calculation_span(price) |
| 31 | + [1, 2, 3, 4, 5] |
| 32 | + """ |
33 | 33 | n = len(price) |
34 | 34 | st = [0] |
35 | 35 | s = [0] * n |
|
0 commit comments