mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +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
@ -176,7 +176,7 @@ class Matrix:
|
||||
return result
|
||||
else:
|
||||
raise TypeError(
|
||||
"Unsupported type given for another (%s)" % (type(another),)
|
||||
"Unsupported type given for another ({})".format(type(another))
|
||||
)
|
||||
|
||||
def transpose(self):
|
||||
@ -248,17 +248,17 @@ if __name__ == "__main__":
|
||||
ainv = Matrix(3, 3, 0)
|
||||
for i in range(3):
|
||||
ainv[i, i] = 1
|
||||
print("a^(-1) is %s" % (ainv,))
|
||||
print(f"a^(-1) is {ainv}")
|
||||
# u, v
|
||||
u = Matrix(3, 1, 0)
|
||||
u[0, 0], u[1, 0], u[2, 0] = 1, 2, -3
|
||||
v = Matrix(3, 1, 0)
|
||||
v[0, 0], v[1, 0], v[2, 0] = 4, -2, 5
|
||||
print("u is %s" % (u,))
|
||||
print("v is %s" % (v,))
|
||||
print(f"u is {u}")
|
||||
print(f"v is {v}")
|
||||
print("uv^T is %s" % (u * v.transpose()))
|
||||
# Sherman Morrison
|
||||
print("(a + uv^T)^(-1) is %s" % (ainv.ShermanMorrison(u, v),))
|
||||
print("(a + uv^T)^(-1) is {}".format(ainv.ShermanMorrison(u, v)))
|
||||
|
||||
def test2():
|
||||
import doctest
|
||||
|
Reference in New Issue
Block a user