mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 16:27:02 +00:00
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing * fixup! Format Python code with psf/black push * # fmt: off / # fmt: on * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
parent
ec2d900b03
commit
8bb7b8f457
|
@ -76,6 +76,7 @@
|
|||
* [Harriscorner](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/harriscorner.py)
|
||||
|
||||
## Conversions
|
||||
* [Decimal To Any](https://github.com/TheAlgorithms/Python/blob/master/conversions/decimal_to_any.py)
|
||||
* [Decimal To Binary](https://github.com/TheAlgorithms/Python/blob/master/conversions/decimal_to_binary.py)
|
||||
* [Decimal To Hexadecimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/decimal_to_hexadecimal.py)
|
||||
* [Decimal To Octal](https://github.com/TheAlgorithms/Python/blob/master/conversions/decimal_to_octal.py)
|
||||
|
@ -267,6 +268,7 @@
|
|||
* [Enigma Machine](https://github.com/TheAlgorithms/Python/blob/master/hashes/enigma_machine.py)
|
||||
* [Hamming Code](https://github.com/TheAlgorithms/Python/blob/master/hashes/hamming_code.py)
|
||||
* [Md5](https://github.com/TheAlgorithms/Python/blob/master/hashes/md5.py)
|
||||
* [Sdbm](https://github.com/TheAlgorithms/Python/blob/master/hashes/sdbm.py)
|
||||
* [Sha1](https://github.com/TheAlgorithms/Python/blob/master/hashes/sha1.py)
|
||||
|
||||
## Linear Algebra
|
||||
|
@ -359,6 +361,7 @@
|
|||
* [Newton Raphson](https://github.com/TheAlgorithms/Python/blob/master/maths/newton_raphson.py)
|
||||
* [Number Of Digits](https://github.com/TheAlgorithms/Python/blob/master/maths/number_of_digits.py)
|
||||
* [Numerical Integration](https://github.com/TheAlgorithms/Python/blob/master/maths/numerical_integration.py)
|
||||
* [Perfect Cube](https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_cube.py)
|
||||
* [Perfect Square](https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_square.py)
|
||||
* [Pi Monte Carlo Estimation](https://github.com/TheAlgorithms/Python/blob/master/maths/pi_monte_carlo_estimation.py)
|
||||
* [Polynomial Evaluation](https://github.com/TheAlgorithms/Python/blob/master/maths/polynomial_evaluation.py)
|
||||
|
@ -644,6 +647,7 @@
|
|||
* [Split](https://github.com/TheAlgorithms/Python/blob/master/strings/split.py)
|
||||
* [Upper](https://github.com/TheAlgorithms/Python/blob/master/strings/upper.py)
|
||||
* [Word Occurrence](https://github.com/TheAlgorithms/Python/blob/master/strings/word_occurrence.py)
|
||||
* [Z Function](https://github.com/TheAlgorithms/Python/blob/master/strings/z_function.py)
|
||||
|
||||
## Traversals
|
||||
* [Binary Tree Traversals](https://github.com/TheAlgorithms/Python/blob/master/traversals/binary_tree_traversals.py)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
|
||||
def decimal_to_any(num: int, base: int) -> str:
|
||||
|
||||
"""
|
||||
Convert a positive integer to another base as str.
|
||||
>>> decimal_to_any(0, 2)
|
||||
|
@ -66,11 +65,12 @@ def decimal_to_any(num: int, base: int) -> str:
|
|||
raise ValueError("base must be >= 2")
|
||||
if base > 36:
|
||||
raise ValueError("base must be <= 36")
|
||||
|
||||
# fmt: off
|
||||
ALPHABET_VALUES = {'10': 'A', '11': 'B', '12': 'C', '13': 'D', '14': 'E', '15': 'F', '16': 'G', '17': 'H',
|
||||
'18': 'I', '19': 'J', '20': 'K', '21': 'L', '22': 'M', '23': 'N', '24': 'O', '25': 'P',
|
||||
'26': 'Q', '27': 'R', '28': 'S', '29': 'T', '30': 'U', '31': 'V', '32': 'W', '33': 'X',
|
||||
'34': 'Y', '35': 'Z'}
|
||||
# fmt: on
|
||||
new_value = ""
|
||||
mod = 0
|
||||
div = 0
|
||||
|
|
|
@ -11,6 +11,6 @@ def perfect_cube(n: int) -> bool:
|
|||
return (val * val * val) == n
|
||||
|
||||
|
||||
if(__name__ == '__main__'):
|
||||
if __name__ == "__main__":
|
||||
print(perfect_cube(27))
|
||||
print(perfect_cube(4))
|
||||
|
|
|
@ -86,4 +86,5 @@ def find_pattern(pattern: str, input_str: str) -> int:
|
|||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
|
Loading…
Reference in New Issue
Block a user