Write a python function where you have a function inside a loop. The loop runs 10 times and the area of a rectangle is calculated 10 times. The width of the rectangle is 5 and the length of the rectangle is the loop variable?
Answers
Answered by
0
Answer:
The code is:
_________________________________
breadth=5
def fun(length):
for length in range (1,11):
length=length+1
area= length*breadth
print("The area is", area)
_________________________________
Output:
_________________________________
[In]
fun(5)
The area is 10
The area is 15
The area is 20
The area is 25
The area is 30
The area is 35
The area is 40
The area is 45
The area is 50
The area is 55
_________________________________
Attachments:
Answered by
0
def area(w):
for l in range(1, 11):
print(f"Area of rectangle is: {l * w}")
if __name__ == "__main__":
area(5)
Similar questions