Guest User

Untitled

a guest
Dec 11th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. #General Features about computers
  2. class Computer:
  3. def __init__(self, model, cpu, ram, storage, os):
  4. self.model = model
  5. self.cpu = cpu
  6. self.ram = ram
  7. self.storage = storage
  8. self.os = os
  9.  
  10. #Function that tell the features line by line
  11. def tell(self):
  12. print("Name: {}\nCPU: {}\nRam: {}\nStorage: {}\nOS: {}".format(self.model, self.cpu, self.ram, self.storage, self.os))
  13.  
  14. #Further features about laptops
  15. class Laptop(Computer):
  16. def __init__(self, model, cpu, ram, storage, os):
  17. Computer.__init__(self, model, cpu, ram, storage, os)
  18. self.weight = 'default'
  19. self.size = 'default'
  20.  
  21. #Function that tell the features line by line
  22. def tell(self):
  23. Computer.tell(self)
  24. print("Weight: {}\nSize: {}\n".format(self.weight, self.size))
  25.  
  26. computer1 = Laptop(input("Enter the Model:"), input("Enter the Cpu:"), input("Enter the ram:"), input("Enter the Storage:"), input("Enter the OS:"))
  27.  
  28. #computer1.cpu = 'Intel Core i5 3Ghz Quad'
  29. #computer1.ram = "8 GB"
  30. #computer1.storage = '250 GB SSD'
  31. #computer1.os = 'Mac OS X High Sierra'
  32. #computer1.weight = '1.67 KG'
  33. #computer1.size = '13 INCH'
  34. computer1.weight = input("Enter the weight:")
  35. computer1.size = input("Enter the size:")
  36.  
  37. print()
  38. computer1.tell()
Add Comment
Please, Sign In to add comment