mmishanchyk

Retake Exam - 14 April 2021 (problem3)

Jun 13th, 2021
666
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def flights(*args):
  2.     cities = []
  3.     people = []
  4.     args = list(args)
  5.     for i in range(len(args)):
  6.         if args[i] == "Finish":
  7.             break
  8.         if i % 2 == 0:
  9.             cities.append(args[i])
  10.         elif i % 2 != 0:
  11.             people.append(args[i])
  12.        
  13.     destination = dict(zip(cities, people))
  14.  
  15.     return destination
  16.  
  17.  
  18. print(flights('Vienna', 256, 'Vienna', 26, 'Morocco', 98, 'Paris', 115, 'Finish', 'Paris', 15))
RAW Paste Data