mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 18:49:26 +08:00
pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py * fixup! Format Python code with psf/black push
This commit is contained in:

committed by
John Law

parent
34c808b375
commit
28419cf839
@ -9,9 +9,9 @@ def n31(a: int) -> Tuple[List[int], int]:
|
||||
"""
|
||||
|
||||
if not isinstance(a, int):
|
||||
raise TypeError("Must be int, not {0}".format(type(a).__name__))
|
||||
raise TypeError("Must be int, not {}".format(type(a).__name__))
|
||||
if a < 1:
|
||||
raise ValueError("Given integer must be greater than 1, not {0}".format(a))
|
||||
raise ValueError(f"Given integer must be greater than 1, not {a}")
|
||||
|
||||
path = [a]
|
||||
while a != 1:
|
||||
|
@ -1 +0,0 @@
|
||||
|
||||
|
@ -37,7 +37,7 @@ def exactPrimeFactorCount(n):
|
||||
if __name__ == "__main__":
|
||||
n = 51242183
|
||||
print(f"The number of distinct prime factors is/are {exactPrimeFactorCount(n)}")
|
||||
print("The value of log(log(n)) is {0:.4f}".format(math.log(math.log(n))))
|
||||
print("The value of log(log(n)) is {:.4f}".format(math.log(math.log(n))))
|
||||
|
||||
"""
|
||||
The number of distinct prime factors is/are 3
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
In mathematics, the Lucas–Lehmer test (LLT) is a primality test for Mersenne numbers.
|
||||
https://en.wikipedia.org/wiki/Lucas%E2%80%93Lehmer_primality_test
|
||||
|
@ -10,7 +10,7 @@ https://www.hackerearth.com/practice/notes/matrix-exponentiation-1/
|
||||
"""
|
||||
|
||||
|
||||
class Matrix(object):
|
||||
class Matrix:
|
||||
def __init__(self, arg):
|
||||
if isinstance(arg, list): # Initialzes a matrix identical to the one provided.
|
||||
self.t = arg
|
||||
|
@ -52,4 +52,4 @@ if __name__ == "__main__":
|
||||
plt.xlabel("step")
|
||||
plt.ylabel("error")
|
||||
plt.show()
|
||||
print("solution = {%f}, error = {%f}" % (solution, error))
|
||||
print(f"solution = {{{solution:f}}}, error = {{{error:f}}}")
|
||||
|
@ -14,7 +14,7 @@ class Point:
|
||||
|
||||
|
||||
def distance(a: Point, b: Point) -> float:
|
||||
return math.sqrt(abs(((b.x - a.x) ** 2 + (b.y - a.y) ** 2 + (b.z - a.z) ** 2)))
|
||||
return math.sqrt(abs((b.x - a.x) ** 2 + (b.y - a.y) ** 2 + (b.z - a.z) ** 2))
|
||||
|
||||
|
||||
def test_distance() -> None:
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Sieve of Eratosthones
|
||||
|
||||
|
Reference in New Issue
Block a user