Summiya14Fis14Samaa

chotu

Dec 18th, 2021
1,119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. class ball:
  2.   def __init__(self, radius):
  3.     self.radius = radius
  4.  
  5.   def show(self):
  6.     print(f"radius of the ball is {self.radius}")
  7.     pass
  8.  
  9.   pass
  10.  
  11. class football(ball):
  12.  
  13.   pass
  14.  
  15.  
  16. class rectangle(ball):
  17.  
  18.   def show(self):
  19.     print(f"The area of the rectangle is: {self.radius*self.radius}")
  20.   pass
  21. print("1. ball\n2. rectangle")
  22. choice = int(input())
  23. if choice == 1:
  24.     a = ball(int(input()))
  25.     a.show()
  26.  
  27. elif choice == 2:
  28.    
  29.     b = rectangle(int(input()))
  30.     b.show()
  31. else:
  32.     print("You Entered Error")
Advertisement
Add Comment
Please, Sign In to add comment