55
66
77def get_factorial (number : int , / ) -> int :
8- """Return the factorial value for a given number
8+ """
9+ Return the factorial value for a given number
10+
11+ In mathematics the factorial is the product of all positive integers
12+ less than or equal to given number.
13+ E.g. 5! = 5 * 4! = 5 * 4 * 3 * 2 * 1 = 120.
14+ The value of 0! = 1 according to the convention of an empty product.
915
1016 :param number:
1117 :type number: int
1218
1319 :return: the factorial value
1420 :rtype: int
1521
16- In mathematics the factorial is the product of all positive integers
17- less than or equal to given number.
18- E.g. 5! = 5 * 4! = 5 * 4 * 3 * 2 * 1 = 120.
19- The value of 0! = 1 according to the convention of an empty product.
20-
21- Usage examples:
22+ Usage:
2223
2324 >>> assert get_factorial(0) == 1
2425 >>> assert get_factorial(5) == 120
@@ -32,19 +33,20 @@ def get_factorial(number: int, /) -> int:
3233
3334
3435def get_fibonacci_number (idx : int , / ) -> int :
35- """Return a Fibonacci's sequence number at a specified index
36+ """
37+ Return a Fibonacci's sequence number at a specified index
38+
39+ The Fibonacci number is a number from the Fibonacci sequence, in which
40+ each number is the sum of the two preceding ones. This sequence commonly
41+ starts from 0 and 1: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...
3642
3743 :param idx: a Fibonacci sequence index starting from 0
3844 :type idx: int
3945
4046 :return: a sequence's member
4147 :rtype: int
4248
43- The Fibonacci number is a number from the Fibonacci sequence, in which
44- each number is the sum of the two preceding ones. This sequence commonly
45- starts from 0 and 1: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...
46-
47- Usage examples:
49+ Usage:
4850
4951 >>> assert get_fibonacci_number(0) == 0
5052 >>> assert get_fibonacci_number(1) == 1
@@ -64,16 +66,25 @@ def get_fibonacci_number(idx: int, /) -> int:
6466
6567
6668def get_fibonacci_number_nr (idx : int , / ) -> int :
67- """Return a Fibonacci's sequence number at a specified index
69+ """
70+ Return a Fibonacci's sequence number at a specified index
71+
72+ This function implements the non-recursive algorithm, which is more
73+ efficient, since it does not have multiple recursive calls.
6874
6975 :param idx: a Fibonacci sequence index starting from 0
7076 :type idx: int
7177
7278 :return: a sequence's member
7379 :rtype: int
7480
75- This function implements the non-recursive algorithm, which is more
76- efficient, since it does not have multiple recursive calls.
81+ Usage:
82+
83+ >>> assert get_fibonacci_number(0) == 0
84+ >>> assert get_fibonacci_number(1) == 1
85+ >>> assert get_fibonacci_number(2) == 1
86+ >>> assert get_fibonacci_number(3) == 2
87+ >>> assert get_fibonacci_number(4) == 3
7788
7889 """
7990
@@ -91,7 +102,11 @@ def get_fibonacci_number_nr(idx: int, /) -> int:
91102
92103
93104def get_sum_of_strings (number_1 : str , number_2 : str , / ) -> str :
94- """Return the sum of two numbers of string type as string
105+ """
106+ Return the sum of two numbers of string type as string
107+
108+ Valid input is a string of any length containing numeric characters from
109+ 0 to 9. Empty strings are allowed as well and should be considered as 0.
95110
96111 :param number_1: first number
97112 :type number_1: str
@@ -101,10 +116,7 @@ def get_sum_of_strings(number_1: str, number_2: str, /) -> str:
101116 :return: the sum of two numbers
102117 :rtype: str
103118
104- Valid input is a string of any length containing numeric characters from
105- 0 to 9. Empty strings are allowed as well and should be considered as 0.
106-
107- Usage examples:
119+ Usage:
108120
109121 >>> assert get_sum_of_strings("123", "456") == "579"
110122 >>> assert get_sum_of_strings("099", "001") == "100"
0 commit comments