python oops practice questions

Solutions on MaxInterview for python oops practice questions by the best coders in the world

showing results for - "python oops practice questions"
Neele
24 Apr 2016
1>>> class Triangle(object):
2...     def __init__(self,angle1,angle2,angle3):
3...         self.angle1=angle1
4...         self.angle2=angle2
5...         self.angle3=angle3
6...
7...     number_of_sides=3
8...     def check_angles(self):
9...         if self.angle1+self.angle2+self.angle3 ==180:
10...             return True
11...         else:
12...             return False
13...
14>>> class Equilateral(Triangle):
15...   angle = 60
16...   def __init__(self):
17...        self.angle1 = self.angle2 = self.angle3 = self.angle
18...
19>>> my_triangle=Triangle(90,30,60)
20>>>
21>>> print my_triangle.number_of_sides
223
23>>> print my_triangle.check_angles()
24True
25>>>
26
27>>>
28
Alice
13 Jan 2020
1class MinimumBalanceAccount(BankAccount):
2    def __init__(self, minimum_balance):
3        BankAccount.__init__(self)
4        self.minimum_balance = minimum_balance
5
6    def withdraw(self, amount):
7        if self.balance - amount < self.minimum_balance:
8            print('Sorry, minimum balance must be maintained.')
9        else:
10            BankAccount.withdraw(self, amount)
11
queries leading to this page
oops question practice pythonpython classes and objects exercisespython oops programming questionsoops class questions in pythonpython inheritance exercisesoops concepts in python practice exercises experiencedoops interview questions python python oops questionspython oops code questionsoops practice in pythonoops practice questions python oops programming questions in pythonbasic python oops problemspractice python classpython oop questionspractice with class product in pythonquestion of opps in pythoninit method in python exercises with solutionspython question classoops coding questions in pythonoops concepts python interview questionsquestions on oops in pythonproblems on oop in pythonbasic questions of python oopspython oops interview questionsoops practice questions in pythonquestion on class using pythonpython oops interview questions tutorialspointpython oops practice programspractice oops concepts pythonoops questions in pythonpractice questions on oops in pythonoops questions pythonpython oops practice questionsoops python questionsexercis on python using oopoops concepts in python interview questionspython questions for practicepython tricky questions and answers based on oops conceptexercises in pythonbasic tasks for python classpython oops practicepython oops question answerspython class questionsoops concepts in python practice exercisesoops interview questions in pythonpython oops concepts interview questionspython practice questionspython oops problemsoop in python practicle questions and answerspython oops beginner questionspython class object skill up exercisespython oop exercises with solutionsoop exercises pythonpython practice problems on oopsoops question for practice in pythonoops question in pythoneasy python class exercisespractice questions of python using classespython class question oops python interview questionspython programming oops concepts interview questionspractice class object in pythonpython learn classes and subclasses exercisesclass problems in pythonclasses and objects questions in pythonoops concepts in python questionsreal exercise oop pythonpython oop practice questionspython exercisespython exercises with solutions init methodpython exercises with solutions init methodoops programs in python for practicepython class exercisesquestion of oops in pythonpython object exercisesexercises on classes in pythonoop concepts in python practice problemspython oops concepts technical interview questionspractice python classespython class practice problemspython oops coding questionspython scripting interview questions for devopsoops problems on pythonpython oops practice questions