fork download
  1. class Supplier:
  2. def __init__(
  3. self,
  4. city,
  5. contact_firstname,
  6. contact_lastname,
  7. contact_title,
  8. country,
  9. email,
  10. notes,
  11. phone,
  12. postcode,
  13. state,
  14. street_address,
  15. supplier_id,
  16. supplier_name,
  17. ):
  18. print("Initialiser called")
  19. self.city = city
  20. self.contact_firstname = contact_firstname
  21. self.contact_lastname = contact_lastname
  22. self.contact_title = contact_title
  23. self.country = country
  24. self.email = email
  25. self.notes = notes
  26. self.phone = phone
  27. self.postcode = postcode
  28. self.state = state
  29. self.street_address = street_address
  30. self.supplier_id = supplier_id
  31. self.supplier_name = supplier_name
  32.  
  33. def get_state(self):
  34. return "The state is {} and the postcode is {}".format(self.state, self.postcode)
  35.  
  36. def set_postcode(self, postcode):
  37. self.postcode = postcode
  38.  
  39.  
  40. # 2. Instantiate the class
  41. Supplier_105 = Supplier(
  42. "Port Bradley",
  43. "Brittany",
  44. "Costa",
  45. "Mrs",
  46. "Australia",
  47. "brittany8706.costa@gmail.com",
  48. "",
  49. "(08) 6939 8022",
  50. "3880",
  51. "Costa",
  52. "6/81 Heather Rosebowl",
  53. "105",
  54. "Rodriguez, Carter and Johnson",
  55. )
  56. print(Supplier_105.supplier_name)
  57.  
  58. # 3. Call its methods here
  59. print(Supplier_105.get_state())
  60.  
  61. Supplier_105.set_postcode('4980')
  62.  
  63. print(Supplier_105.get_state())
  64.  
  65.  
Success #stdin #stdout 0.02s 9140KB
stdin
Standard input is empty
stdout
Initialiser called
Rodriguez, Carter and Johnson
The state is Costa and the postcode is 3880
The state is Costa and the postcode is 4980