Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Plane:
- def __init__(self, planeName, planeType):
- self.__planeName = planeName
- self.__planeType = planeType
- def getName(self):
- return self.__planeName
- def getType(self):
- return self.__planeType
- def __str__(self):
- return f"Name: {self.__planeName}, Type: {self.__planeType}"
- # Initializing the parking as a 2D list
- parking = []
- # Adding planes to rows
- rowOne = [Plane("BCX 292", "Embrarer 195"), Plane("BCZ 182", "Embrarer 190"), Plane("BHT 894", "Embrarer 195")]
- rowTwo = [Plane("XSK 922", "Airbus 330"), Plane("IUY 293", "Airbus 350"), Plane("NFF 912", "Boeing 777"), Plane("XSJ 883", "Airbus 350")]
- rowThree = [Plane("KSJ 948", "Airbus 380"), Plane("PSJ 829", "Boeing 747")]
- # Adding rows to the parking lot
- parking.append(rowOne)
- parking.append(rowTwo)
- parking.append(rowThree)
- # Removing a specific plane from rowOne
- del parking[0][1]
- # Printing information for planes specifically of the "Airbus" type
- for row in parking:
- for plane in row:
- if "Airbus" in plane.getType():
- print(plane, end=" ")
- print("") # To ensure proper formatting with a newline between rows
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement