0% found this document useful (0 votes)
10 views2 pages

Single Inheritance: Source Code

This document discusses single inheritance in Python. It defines a base class called bgs that takes user input and displays processing data. It then defines a derived class called grnd that inherits from bgs, takes additional user input, and overrides the display method to provide more specific output about a renewal process taking 20 days and listing common sports played at the location.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Single Inheritance: Source Code

This document discusses single inheritance in Python. It defines a base class called bgs that takes user input and displays processing data. It then defines a derived class called grnd that inherits from bgs, takes additional user input, and overrides the display method to provide more specific output about a renewal process taking 20 days and listing common sports played at the location.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SINGLE INHERITANCE

SOURCE CODE:
class bgs:

def __init__(self):

self.ask=''

def Input_data(self):

self.ask=raw_input('Enter the detail you want to know:')

def Display(self):

print 'Processing data about', self.ask, '....'

class grnd(bgs):

def __init__(self):

self.info=''

def Input(self):

self.info=raw_input('Please confirm your choice:')

def Show(self):

print 'Your', self.ask, 'Is under renewation.'

print 'It will take 20 days to be completed.'

print "It is at it's last phases."

print '''Sports played here are:

Football

Tennis

Cricket

Skating
Badminton

Basketball'''

o=grnd()

o.Input_data()

o.Input()

o.Display()

o.Show()

OUTPUT:

You might also like