Add typehints to blockchain (#3149) · silam/TheAlgorithmPython@0febbd3 · GitHub
Skip to content

Commit 0febbd3

Browse files
jenia90github-actions
andauthored
Add typehints to blockchain (TheAlgorithms#3149)
* updating DIRECTORY.md * updating DIRECTORY.md * Added type hints to blockchain algorithms * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent e077662 commit 0febbd3

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

blockchain/chinese_remainder_theorem.py

Lines changed: 4 additions & 4 deletions

blockchain/diophantine_equation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor )
66

77

8-
def diophantine(a, b, c):
8+
def diophantine(a: int, b: int, c: int) -> (int, int):
99
"""
1010
>>> diophantine(10,6,14)
1111
(-7.0, 14.0)
@@ -37,7 +37,7 @@ def diophantine(a, b, c):
3737
# n is the number of solution you want, n = 2 by default
3838

3939

40-
def diophantine_all_soln(a, b, c, n=2):
40+
def diophantine_all_soln(a: int, b: int, c: int, n: int = 2) -> None:
4141
"""
4242
>>> diophantine_all_soln(10, 6, 14)
4343
-7.0 14.0
@@ -72,7 +72,7 @@ def diophantine_all_soln(a, b, c, n=2):
7272
# Euclid's Algorithm
7373

7474

75-
def greatest_common_divisor(a, b):
75+
def greatest_common_divisor(a: int, b: int) -> int:
7676
"""
7777
>>> greatest_common_divisor(7,5)
7878
1
@@ -98,7 +98,7 @@ def greatest_common_divisor(a, b):
9898
# x and y, then d = gcd(a,b)
9999

100100

101-
def extended_gcd(a, b):
101+
def extended_gcd(a: int, b: int) -> (int, int, int):
102102
"""
103103
>>> extended_gcd(10, 6)
104104
(2, -1, 2)

blockchain/modular_division.py

Lines changed: 6 additions & 6 deletions

0 commit comments

Comments
 (0)