Python 4.8 : Exercise : Draw a square
We will continue our learning with another exercise here, we are going to draw a square I invite you to do differently than what we did concerning the stairs, we are going to call the function square without accent inside we are going to put size so we are going to create a function square which takes as a parameter the size We invite you to do this and we'll meet again in a few minutes for the correction concerning the correction for our exercise we will start by commenting this and here I will create a function with the definition def carre which takes in parameter the size and we will start by making a t point forward the size and we will call our function here inside the two lines carre and inside, I'll put 50 pixels it is displayed and then I'll make a t point left of 90 the angle I restart you can see that it's well positioned, if I do this 4 times it will turn the same way so I'm going to do at this point For i in range so it has to rotate 4 times parenthesis zero comma four colon I'm going to put this inside I throw you see that this forms our square right, if I want to draw two squares, I want to copy this I'm going to ... I'm going to paste it in here at the top and I'm going to change the size by putting even 100 you can see that it draws the big square first and then it draws the small one so everything works normally, we'll see you soon for the next exercise concerning the drawing of several squares.