Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

child class in python

class Person:
  def __init__(self, fname, lname):
    self.firstname = fname
    self.lastname = lname

  def printname(self):
    print(self.firstname, self.lastname)

class Student(Person):
  def __init__(self, fname, lname, year):
    super().__init__(fname, lname)
    self.graduationyear = year

x = Student("Mike", "Olsen", 2019)
print(x.graduationyear)
Comment

PREVIOUS NEXT
Code Example
Python :: comentar codigo en python 
Python :: how to import somthing from another directory in pyhon 
Python :: remove all occurences 
Python :: access list index python 
Python :: run ipython inside pipenv 
Python :: how to access pandas column 
Python :: object oriented programming python 
Python :: Python list function tutorial 
Python :: matplotlib.plot python 
Python :: Remove an element from a Python list Using remove() method 
Python :: python ravel function 
Python :: python convert np datetime to string 
Python :: python how to create a class 
Python :: python variables and data types 
Python :: pandas drop columns 
Python :: how to append to a string in python 
Python :: how to slice list 
Python :: assert python 3 
Python :: python unicode point to utf8 string 
Python :: python 2d matrix declare 
Python :: comment all selected lines in python 
Python :: deque python 
Python :: python programming language 
Python :: python decimal 
Python :: how to add number in tuple 
Python :: python max of two numbers 
Python :: heroku procfile 
Python :: python program to calculate factorial of a number. 
Python :: punto1 
Python :: a string varible in python 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =