00:01
In this question, we have to write a code in python and we have to use, let us look at the approach that we will use to solve this question.
00:16
So, we have to use a function that is drawtriangle in this case.
00:27
So, this function will take an integer that is baselength as input and uses recursion and to draw the right side up isosyllux triangle.
00:40
So, it will use the recursion method.
00:48
Now, in each recursive call, the function will check if the baselength has reached the smallest possible length.
00:56
If so, it will print the length with a single star in such a way.
01:03
So, and nine spaces before it, that is there.
01:07
If the baselength is greater than one, then the function will make a recursive call with a smaller baselength.
01:14
So, this recursive call will draw the upper part of the triangle.
01:19
So, we have to draw a triangle with stars like this in such a way that it will help our condition.
01:29
So, after the recursive call, the function prints the current line which will consist of spaces and this.
01:37
So, there should be spaces also as you can see here and the object also that is this.
01:45
So, let us look at the code for approach on how we are going to do this.
01:52
So, for that, i will write a code in a basic compiler and show you.
01:57
So, the first thing that we are doing here is we will define a drawtriangle function as i told you.
02:08
So, it will take the parameter baselength as you can see here.
02:14
So, now it represents the length of the base of the triangle.
02:19
It uses now recursion to draw the right side up of the isosceles triangle.
02:24
So, now for that, we have to give an if condition.
02:31
So, let us look at how we will do that.
02:33
So, if the first if condition in the first if condition that is this, we check if the baselength has reached 1 which is the smallest possible baselength for the triangle.
02:47
So, now if it is 1, we will execute the following line.
02:52
So, that is why it will print that single star over there.
02:55
So, now what if the baselength is not equal to 1? if it is not equal to 1, then we will move the else block and execute the following...