passengers = { "row_12A": {"type": "anxious", "needs": "reassurance"}, "row_14C": {"type": "child", "needs": "snack"}, "row_22F": {"type": "elderly", "needs": "water"}, "row_08B": {"type": "angry", "needs": "complaint_about_delay"}, "row_30D": {"type": "medical", "needs": "asthma_inhaler"} }
def handle_passenger(seat): if seat not in passengers: print(f"No passenger found at {seat}.") return p = passengers[seat] print(f"Approaching {seat} – {p['type']} passenger.") if p['needs'] == "reassurance": print("You calmly explain the situation. The passenger relaxes.") cabin_status['passenger_calm'] += 5 del passengers[seat] elif p['needs'] == "snack": print("You give the child a snack. They smile happily.") cabin_status['passenger_calm'] += 3 del passengers[seat] elif p['needs'] == "water": print("You bring water to the elderly passenger. They thank you.") cabin_status['passenger_calm'] += 4 del passengers[seat] elif p['needs'] == "complaint_about_delay": print("You listen patiently and offer a free drink voucher. The passenger calms down.") cabin_status['passenger_calm'] += 6 del passengers[seat] elif p['needs'] == "asthma_inhaler": print(" You retrieve the onboard first aid kit and assist with the inhaler. Passenger stabilizes.") cabin_status['medical_emergency'] = True cabin_status['passenger_calm'] -= 10 del passengers[seat] else: print("You try to help but the request is unclear. No effect.")
actions = { "1": "Serve beverages", "2": "Check seatbelts", "3": "Handle passenger request", "4": "Make PA announcement", "5": "Prepare for landing", "6": "Respond to emergency", "7": "View cabin status", "8": "End shift" } def print_slow(text, delay=0.03): for char in text: print(char, end='', flush=True) time.sleep(delay) print("\n")
Select action: 2 Checking seatbelts. Everyone is secured.
def cabin_status_report(): print("\n--- CABIN STATUS REPORT ---") print(f"Seatbelt sign: {'ON' if cabin_status['seatbelt_sign'] else 'OFF'}") print(f"Cabin temp: {cabin_status['cabin_temp']}") print(f"Turbulence: {'YES' if cabin_status['turbulence'] else 'NO'}") print(f"Medical emergency: {'YES' if cabin_status['medical_emergency'] else 'NO'}") print(f"Passenger calm level: {cabin_status['passenger_calm']}%") print(f"Crew morale: {cabin_status['cabin_crew_morale']}%") print("Passenger needs pending:") for seat, info in passengers.items(): print(f" - {seat}: {info['type']} wants {info['needs']}") print("----------------------------\n")