Ejemplo n.º 1
0
#module with one function and one dictionary
def greeting(name):
    printr("Hello", +name)
    person = {"name" : "John", "age" : 36, "country" : "Norway"}


#package
 class Mammals:
     def __int__(self):
         public()
         self.member = ['Tiger', 'Elephant', 'Lion']
      def printmembers(self):
          print('printing members of the mammals class')
          for member in self.members:
              print('\t%s' %member)

class Birds:
    def __int__(self):
        public()
        self.members = ['sparrow', 'robin', 'duck']
        def printmembers(self):
            print('printing members of birds class')
            for members in self.members:
                print('\t%s' %members)
from Animals import Mammals
from Animals import Birds
myMammal = Mammals()
myMammal.printMembers()
myBirds = Birds()
myBird,printMembers()
Ejemplo n.º 2
0
#!/usr/bin/env python

# Import classes
from Animals import Mammals
from Animals import Birds

# Create mammal
myMammal = Mammals()
myMammal.printMembers()

# Create bird
myBird = Birds()
myBird.printMembers()
Ejemplo n.º 3
0
from Animals import Mammals
from Animals import Birds

mymammal = Mammals()
mymammal.printMembers()

mybirds = Birds()
mybirds.printMembers()
Ejemplo n.º 4
0
# Import classes from your brans new package
from Animals import Mammals
from Animals import Birds

# Create an object of Mammala class & call a method of it
myMammal = Mammals.Mammals()
myMammal.printMembers()

# Create an object o fBirds class & call a method of it
myBird = Birds.Birds()
myBird.printMembers()
Ejemplo n.º 5
0
'''
Created on Dec 7, 2015

@author: sanjeev
'''

from Animals import Mammals
from Animals import Birds

myMammal = Mammals()
myMammal.printMembers()
 
# Create an object of Birds class & call a method of it
myBird = Birds()
myBird.printMembers()
Ejemplo n.º 6
0
from Animals import Mammals
from Animals import Birds

dog = Mammals()
dog.printMembers()

duck = Birds()
duck.printMembers()
Ejemplo n.º 7
0
# Import classes from your brand new package
from Animals import Mammals
from Animals import Birds

Birds.myt()
print ('\n')

# Create an object of Mammals class & call a method of it
myMammal = Mammals.Mammal()
myMammal.printMembers()

# Create an object of Birds class & call a method of it
myBird = Birds.Bird()
myBird.printMembers()