Advertisement
Toma252

4.1 square 2

Oct 16th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #This program calculates circumference and area of a square using def#
  2. ######################################################################
  3.  
  4. # Square circumference
  5. def square_circumference(base):
  6.     circumference = 4 * a
  7.     return circumference
  8.    
  9. # Square area
  10. def square_area(base):
  11.     area = a * a
  12.     return area
  13.  
  14. # The base of a square
  15. a = float(input("Enter base of a square = "))
  16. C = square_circumference(a)
  17. A = square_area(a)
  18.  
  19. # Print the result
  20. print("\n")
  21. print("Square circumference and area are %f and %f, resectively" % (C, A))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement