How to use class with super to access parent class methods in Python

1 Answer

0 votes
class Worker:
    def name(self):
        print("Emma")

class School(Worker):
    def name(self):
        print("Hogwarts ")
        super().name()

o = School()
o.name()





'''
run:

Hogwarts 
Emma

'''

 



answered Oct 8, 2020 by avibootz

Related questions

1 answer 193 views
1 answer 347 views
1 answer 198 views
1 answer 179 views
...