class FlightTicket:
def __init__(self, country_name: str, departure_time: int):
self.country_name = country_name
self.departure_time = departure_time
def read_departure_time(self):
print(self.departure_time)
def is_ticket(self, query: str) -> bool:
if query == self.country_name:
return True
else:
return False
class Receipt:
def __init__(self, store_name: str, price: int):
self.store_name = store_name
self.price = price
def is_ticket(self, query: str) -> bool:
return False
class Phone:
def __init__(self, brand: str, is_on: bool):
self.brand = brand
self.is_on = False
def turn_on(self):
self.is_on = True
def turn_off(self):
self.is_on = False
def is_ticket(self, query: str) -> bool:
return False
things_in_bag = [Receipt("Starbucks", 13), Phone("Apple", False), FlightTicket("Japan", 400),
Receipt("Uniqlo", 200), Receipt("Brown Bookstore", 350)]
def search(item, query: str) -> bool:
if item.is_ticket(query):
return True
else:
return False
for item in things_in_bag:
if search(item, "Japan"):
print('The flight ticket for Japan is in the bag!')
else:
print('This is not the flight ticket')