besti11's picture
Upload station.py
646cc40 verified
raw
history blame contribute delete
853 Bytes
import time
# System setup: List of stations and their current demand
stations = ["A", "B", "C", "D", "E", "F"]
demand_board = {station: 0 for station in stations}
def display_dashboard():
"""Simulates the transit board displaying current demand."""
print("\n--- Live Transit Intent Dashboard ---")
for s in stations:
print(f"Station {s}: {demand_board[s]} passengers waiting")
print("-------------------------------------")
def user_press_button(station_name):
"""Simulates a passenger declaring their intent to board."""
if station_name in demand_board:
demand_board[station_name] += 1
print(f"\n[System] Intent confirmed for Station {station_name}!")
display_dashboard()
else:
print("Error: Station not found.")
# Demo the interaction
display_dashboard()
user_press_button("A")