Last answered:

24 Jan 2022

Posted on:

23 Jan 2022

0

Resolved: Code in Sierpinski Triangle

From the code snippet below, i do not see trans as a function that is defined hence i donot understand why when that function is called does not give an error.

image

1 answers ( 1 marked as helpful)
Instructor
Posted on:

24 Jan 2022

0

Hey Sylvester,

Thank you for your question!

In the code, trans is one of the functions trans_1, trans_2, or trans_3. This is done with the help of the choice() method. choice(transformations) is the same as choice([trans_1,trans_2,trans_3]) and its purpose is to choose either of the three functions and assign it to the trans variable.

Hope that helps!

Kind regards,
365 Hristina

Submit an answer