Skip to content

Exercise 3.3.13 ruler #2

Description

@bitflame

Hello
The following is my attempt at this problem. Is there any part of it that should do different? I saw your code. By the way, thank you so much for this content. It helped me a lot so far, and I have only read chapter 3.
def fractal_generator(index, n):
if n < 0.125: return
if n % 1 == 0:
print(f"---- {index}")
fractal_generator(index, n / 2)
if n == 0.5:
print("---")
elif n == 0.25:
print("--")
elif n == 0.125:
print("-")
if n < 1:
fractal_generator(index, n / 2)

fractal_generator(1)

print(fractal_generator(3))

def myMethod(n):
for i in range(n):
# print(f'---- {i}')
fractal_generator(i, 1)

myMethod(4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions