tempCodeRunnerFile.python 407 B

12345678910111213141516171819
  1. def handle_order(s):
  2. arr = s.split(" ")
  3. dict = {}
  4. for i in arr:
  5. temp = i.split(":")
  6. if temp[1] == "0":
  7. dict["0"] = temp[0]
  8. elif temp[1] == "1":
  9. dict["1"] = temp[0]
  10. elif temp[1] == "2":
  11. dict["2"] = temp[0]
  12. a = sorted(dict.items(),key= lambda d :d[0])
  13. return a
  14. s= "SQS:1 HTTPS:0 LAMBDA:2"
  15. print(handle_order(s))