Advertisement
Adehumble

Week8|9 Coding Exercise 2

Apr 1st, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. #2
  2. #This program is written to demonstrates a simple class that creates and accepts instances.
  3.  
  4.  
  5. class Skyscraper():
  6.     """
  7.     This is a class with two attrubutes and it's being used to creates two different objects.
  8.    
  9.     """
  10.    
  11.     def __init__(self,name,year):
  12.         self.name=name
  13.         self.year=year
  14.        
  15.    
  16.    
  17. #The following lines are the objects made from the blueprint of a Skyscraper class with their respective instances.
  18.        
  19. empire=Skyscraper("Empire State Building", 1931)
  20. wtc=Skyscraper(year=2014, name="One World Trade Centre")
  21.  
  22.  
  23.  
  24. #The following prints statements, if uncommented, validates that the corresponding print statements arguments are executable for each Skyscraper class objects.
  25.  
  26. #print(wtc.name)
  27. #print("\n",empire.year)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement