Advertisement
horozov86

Parking Lot

May 10th, 2023
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. def print_func(data):
  2.     if data:
  3.         for car in parking_cars:
  4.             print(car)
  5.     else:
  6.         print(f"Parking Lot is Empty")
  7.  
  8. n = int(input())
  9.  
  10. parking_cars = set()
  11.  
  12. for _ in range(n):
  13.     information = input()
  14.     information_split = information.split(", ")
  15.     direction = information_split[0]
  16.     plate_number = information_split[1]
  17.    
  18.     if direction == "IN":
  19.         parking_cars.add(plate_number)
  20.    
  21.     elif direction == "OUT":
  22.         parking_cars.remove(plate_number)
  23.        
  24. print_func(parking_cars)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement