Question: I need to draw a recursively defined picture in python 3. My program is displaying the right output but their is unneeded whitespace. Here is

I need to draw a recursively defined picture in python 3. My program is displaying the right output but their is unneeded whitespace. Here is my program:

def fractal(length, spaces): if length == 1: print(spaces * " ", '*') else: fractal(int(length / 2), spaces) print(spaces * " ", length * "*") fractal(int(length / 2),spaces + int (length / 2))

def getinput(): x = input("Enter an integer > 0: ") if x.isdigit() : return int(x) else: return getinput()

if __name__ == "__main__": x = getinput() fractal(x, 0)

I need to draw a recursively defined picture in python 3. My

Cats Input 3 Fractal Generator Enter an integer 0: Enter an integer > 0 Your output Fractal Generator Enter an integer >0: Enter an integer0 Expected output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!