Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ball:
- def __init__(self, radius):
- self.radius = radius
- def show(self):
- print(f"radius of the ball is {self.radius}")
- pass
- pass
- class football(ball):
- pass
- class rectangle(ball):
- def show(self):
- print(f"The area of the rectangle is: {self.radius*self.radius}")
- pass
- print("1. ball\n2. rectangle")
- choice = int(input())
- if choice == 1:
- a = ball(int(input()))
- a.show()
- elif choice == 2:
- b = rectangle(int(input()))
- b.show()
- else:
- print("You Entered Error")
Advertisement
Add Comment
Please, Sign In to add comment