00:01
Here's how you create a program in python that takes input from the user, which is a shape, and calculates the area of that shape.
00:13
For this example, we're going to need three different functions.
00:22
For our functions, we're going to use a square, circle, and a rectangle for our program.
00:33
So there creates a square and we need a parameter of one, just one parameter, which we'll call it a side.
00:46
And we will take the area, store this variable, which is called area, and we'll multiply the side by itself twice, and which is the area for a square.
01:12
Then we just simply want to print out the results.
01:19
Area of the square is, and then we use our variable that we just created, which is area.
01:28
Next we're going to use a rectangle.
01:30
We're going to create our function for the rectangle.
01:36
We're going to need two perenders this time, which we're going to use.
01:40
We're going to length and width.
01:47
And now we're going to hit the, we're going to calculate the area, which is length times width.
02:04
And then we're going to print this out.
02:07
Area of the next angle is.
02:14
And then area.
02:23
It puts your instead of the last, but not these, we're going to create a function for circle.
02:37
Here we just need the radius.
02:41
So we are going to create one variable and we're going to call it pi, we're going to cut the equal one for, and we're going to need the radius, which is, oh sorry, the area.
03:02
We're going to put the pi times the radius.
03:09
We'll put this out on more and an area here.
03:25
Now that we have everything, we can then go to our main code where we ask the user to input what shape they would like to calculate that right for.
03:40
So to do this, we need the user shape and use the user input and ask the user, enter the shape.
04:02
We calculate area.
04:09
Then we create an if statement.
04:18
So if we use your shape, we want to ignore whether it's uppercase or lowcase.
04:25
If it's equal to square, and then going to pass the user to input the length of their side.
04:49
We then type in a message, what is length, and line.
05:05
And then once we have that from the user, we're going to recall our function, and we're going to put in the user's then as our parameter...