AttributeError: ‘list’ object has no attribute ‘end_stop’

For a school project we have to make a working rail-road system. One part of the system is a Board_passengers function. I have the following Classes:

class Station:
  def __init__(self, name, number_of_tracks):
    self.name = name
    self.number_of_tracks = number_of_tracks
    self.waiting_pass = []

  def __str__(self):
    return(f"Station {self.name} has {self.number_of_tracks} tracks. The passengers waiting are {self.waiting_pass}")

  def set_waiting_passengers(self, waiting_passengers):
    self.waiting_pass = [waiting_passengers]
class Centraal(Station):
  def __init__(self, name, list_of_stores):
    self.name = name
    self.number_of_tracks = 10
    self.waiting_pass = []
    self.list_of_stores = list_of_stores

  def add_store(self, store):
    self.list_of_stores.append(store)

  def remove_store(self, store):
    if store in self.list_of_stores:
      self.list_of_stores.remove(store)
class Passenger:
  def __init__(self, name, start_stop, end_stop):
    self.name = name
    self.start_stop = start_stop
    self.end_stop = end_stop
    self.has_arrived = False



  def arrived(self):
   self.has_arrived = True

  def __repr__(self):
    travel_str = "travelled" if self.has_arrived else "travels"
    return f"{self.name} {travel_str} from {self.start_stop} to {self.end_stop}"
class Train:
  def __init__(self, num_train_parts, capacity, speed, route):
    self.num_train_parts = num_train_parts
    self.capacity = capacity
    self.speed = speed
    self.route = route
    self.current_stop_index = 0
    self.current_stop = self.route[self.current_stop_index]
    self.passengers = []

  def get_current_stop(self):
    return self.current_stop

  def go_next_stop(self):
    if self.current_stop_index < len(self.route) -1:
      self.current_stop_index += 1
      self.current_stop = self.route[self.current_stop_index]
    else:
      print("This is the last stop on the route")

  def set_passengers(self, passengers):
    self.passengers = passengers

  def board_passengers(self):
    current_stop = self.get_current_stop()
    waiting_passengers = current_stop.waiting_pass.copy()
    for passenger in waiting_passengers:
      if len(self.passengers) < self.capacity:
        if passenger.end_stop in self.route:
          self.passengers.append(passenger)
          current_stop.waiting_pass.remove(passenger)
      else:
        break

  def unboard_passengers(self):
    current_stop = self.get_current_stop()
    remaining_passengers = self.passengers.copy()
    for passenger in remaining_passengers:
      if passenger.end_stop == current_stop.name:
        self.passengers.remove(passenger)

I also made a list of passengers as follows:

list_of_passengers = []

for id in range(10):
    passenger = Passenger(id, station_r_c, station_r_a)
    list_of_passengers.append(passenger)

station_r_c.set_waiting_passengers([passenger.name for passenger in list_of_passengers])

And I made some stations:

station_r_a = Station("Rotterdam Alexander", 2)
station_r_c = Centraal("Rotterdam Centraal", ['Hema', 'AH to go', 'Dudok'])

Now, when I run the following code, actually running the board.passengers function:

train1 = Train(2, 10, 120, [station_r_c, station_r_a])

train1.board_passengers()

I get the output and error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-72-fe56f8ef609b> in <cell line: 4>()
      2 train1 = Train(2, 10, 120, [station_r_c, station_r_a])
      3 
----> 4 train1.board_passengers()

<ipython-input-53-6cf34d8258f3> in board_passengers(self)
     28     for passenger in waiting_passengers:
     29       if len(self.passengers) < self.capacity:
---> 30         if passenger.end_stop in self.route:
     31           self.passengers.append(passenger)
     32           current_stop.waiting_pass.remove(passenger)

AttributeError: 'list' object has no attribute 'end_stop'

I’ve tried everything but I can’t work out why Python has such a problem with getting the end_stop from the passengers. Can anyone help me out?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật