mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038) * refactor: Fix naming conventions (#7038) * Update arithmetic_analysis/lu_decomposition.py Co-authored-by: Christian Clauss <cclauss@me.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038) * chore: Fix naming conventions in doctests (#7038) * fix: Temporarily disable project euler problem 104 (#7069) * chore: Fix naming conventions in doctests (#7038) Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -35,30 +35,30 @@ PROGNAME = "Sierpinski Triangle"
|
||||
points = [[-175, -125], [0, 175], [175, -125]] # size of triangle
|
||||
|
||||
|
||||
def getMid(p1, p2):
|
||||
def get_mid(p1, p2):
|
||||
return ((p1[0] + p2[0]) / 2, (p1[1] + p2[1]) / 2) # find midpoint
|
||||
|
||||
|
||||
def triangle(points, depth):
|
||||
|
||||
myPen.up()
|
||||
myPen.goto(points[0][0], points[0][1])
|
||||
myPen.down()
|
||||
myPen.goto(points[1][0], points[1][1])
|
||||
myPen.goto(points[2][0], points[2][1])
|
||||
myPen.goto(points[0][0], points[0][1])
|
||||
my_pen.up()
|
||||
my_pen.goto(points[0][0], points[0][1])
|
||||
my_pen.down()
|
||||
my_pen.goto(points[1][0], points[1][1])
|
||||
my_pen.goto(points[2][0], points[2][1])
|
||||
my_pen.goto(points[0][0], points[0][1])
|
||||
|
||||
if depth > 0:
|
||||
triangle(
|
||||
[points[0], getMid(points[0], points[1]), getMid(points[0], points[2])],
|
||||
[points[0], get_mid(points[0], points[1]), get_mid(points[0], points[2])],
|
||||
depth - 1,
|
||||
)
|
||||
triangle(
|
||||
[points[1], getMid(points[0], points[1]), getMid(points[1], points[2])],
|
||||
[points[1], get_mid(points[0], points[1]), get_mid(points[1], points[2])],
|
||||
depth - 1,
|
||||
)
|
||||
triangle(
|
||||
[points[2], getMid(points[2], points[1]), getMid(points[0], points[2])],
|
||||
[points[2], get_mid(points[2], points[1]), get_mid(points[0], points[2])],
|
||||
depth - 1,
|
||||
)
|
||||
|
||||
@ -69,8 +69,8 @@ if __name__ == "__main__":
|
||||
"right format for using this script: "
|
||||
"$python fractals.py <int:depth_for_fractal>"
|
||||
)
|
||||
myPen = turtle.Turtle()
|
||||
myPen.ht()
|
||||
myPen.speed(5)
|
||||
myPen.pencolor("red")
|
||||
my_pen = turtle.Turtle()
|
||||
my_pen.ht()
|
||||
my_pen.speed(5)
|
||||
my_pen.pencolor("red")
|
||||
triangle(points, int(sys.argv[1]))
|
||||
|
Reference in New Issue
Block a user