Answer to Question #318382 in Python for area and perimeter

Question #318382

Area and Perimeter of square


you are given a side of square as input.Write a program to find the perimeter and area of square.


input

the input is an integer representing the length of the side of the square


output

the first line of the output should contain area of the square, and the second line of the output should contain the perimeter of the square as per the format shown in the sample output.


explanation

given the length of the side is 2 .

as the area of square is side*side and perimeter of the square is 4*side


the output should be


area of the square is : 4

perimeter of the square is : 8


sample input 1

3


sample output 1

area of the square is : 9

perimeter of the square is : 12


sample input 2

4


sample output 2

area of the square is : 16

perimeter of the square is : 16


1
Expert's answer
2022-03-26T18:45:28-0400
def area_per(l):
    return 'The area and perimeter of the square is given by {} and {}'.format(l ** 2, 4 * l)
area_per(2)

'The area and perimeter of the square is given by 4 and 8'

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS