Skip to content

Commit af0810f

Browse files
authoredAug 18, 2021
[mypy] Fix type annotations for maths (TheAlgorithms#4617)
* Fix mypy errors for armstrong_numbers.py * Fix mypy errors for harmonic_series.py * Fix mypy errors for average_median.py
1 parent 4545270 commit af0810f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
 

‎maths/armstrong_numbers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
On-Line Encyclopedia of Integer Sequences entry: https://oeis.org/A005188
1010
"""
1111
PASSING = (1, 153, 370, 371, 1634, 24678051, 115132219018763992565095597973971522401)
12-
FAILING = (-153, -1, 0, 1.2, 200, "A", [], {}, None)
12+
FAILING: tuple = (-153, -1, 0, 1.2, 200, "A", [], {}, None)
1313

1414

1515
def armstrong_number(n: int) -> bool:

‎maths/average_median.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from typing import Union
22

33

4-
def median(nums: Union[int, float]) -> Union[int, float]:
4+
def median(nums: list) -> Union[int, float]:
55
"""
66
Find median of a list of numbers.
77
Wiki: https://en.wikipedia.org/wiki/Median
88
99
>>> median([0])
1010
0
11-
>>> median([4,1,3,2])
11+
>>> median([4, 1, 3, 2])
1212
2.5
1313
>>> median([2, 70, 6, 50, 20, 8, 4])
1414
8

‎maths/series/harmonic_series.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def harmonic_series(n_term: str) -> list:
3333
['1']
3434
"""
3535
if n_term == "":
36-
return n_term
37-
series = []
36+
return []
37+
series: list = []
3838
for temp in range(int(n_term)):
3939
series.append(f"1/{temp + 1}" if series else "1")
4040
return series

0 commit comments

Comments
 (0)
Please sign in to comment.