Sichanov

flights

Feb 14th, 2022
1,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. def flights(*args):
  2.     flights = {}
  3.     destination = [i for i in args[:args.index('Finish')] if not str(i).isdigit()]
  4.     passengers = [int(i) for i in args[:args.index('Finish')] if str(i).isdigit()]
  5.     for i, j in zip(destination, passengers):
  6.         if i not in flights:
  7.             flights[i] = j
  8.         else:
  9.             flights[i] += j
  10.     return flights
Advertisement
Add Comment
Please, Sign In to add comment