the derived class (initiallyinherits all of the attributes of the parent class as an examplethe class shire_person below inherits the attributes nameageand address from its parent class person this is done using the super functionused here to refer to the parent class person without naming it explicitly when creating new object of type shire_personthe __init__ method of the parent class is invokedand an additional instance attribute shire_address is created the dir function confirms that shire_address is an attribute only of shire_person instances class person def __init__ (self ,name)self name name self age self address class shire_person person )def __init__ (self ,name)super (__init__ (nameself shire_address 'bag end shire_person (frodo " person (gandalf "print (dir( )[: dir( )- :print (dir( )[: dir( )- :[shire_address '['address ''age ''name '['__class__ '['address ''age ''name ' files to write to or read from filea file first needs to be opened the open function in python creates file object that is iterableand thus can be processed in sequential manner in for or while loop here is simple example fout open('output txt ',' 'for in range ( , )if % = fout write ('{: }\nformat ( )fout close (the first argument of open is the name of the file the second argument specifies if the file is opened for reading (' ')writing (' ')appending (' ')and so on see help(openfiles are written in text mode by defaultbut it is also possible to write in binary mode the above program creates file output txt with linescontaining the strings note that if we had written fout write(iin the fourth line of the code abovean error message would be producedas the variable is an integerand not string recall that the expression string format(is python' way to specify the format of the output string the formatting syntax {: dindicates that the output should be constrained to specific width of three characterseach of which is decimal value as mentioned in the