Then implement function drawlevy so it takes non-negative


The Lévy curves are fractal graphical patterns that can be defined recursively. Like the Koch curves, for every non-negative integer n > 0, the Lévy curve Ln can be defined in terms of Lévy curve Ln-1; Lévy curve L0 is just a straight line. Figure 10.23 from the textbook shows the Lévy curve L8.

Implement a recursive function levy() that takes a non-negative integer and returns turtle instructions encoded with letters L, R and F, where L means "rotate left 45 degrees," R means "rotate right 90 degree," and F means "go forward".

>>> levy(0)

'F'

>>> levy(1)

'LFRFL'

>>> levy(2)

'LLFRFLRLFRFLL'

Then implement function drawLevy() so it takes non-negative integer n as input and draws the levy curve Ln using instructions obtained from function levy(). Don't forget doc strings and comments.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Then implement function drawlevy so it takes non-negative
Reference No:- TGS0932236

Now Priced at $30 (50% Discount)

Recommended (94%)

Rated (4.6/5)