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)
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)