fork download
  1. a = ["alpha", "beta", "gamma"]
  2. b = ["a", "b", "c", "d"]
  3. c = ["one", "two", "three", "four", "five"]
  4.  
  5. def mapping():
  6. i = 0
  7. key = {}
  8. for _a in a:
  9. for _b in b:
  10. for _c in c:
  11. key["-".join([_a, _b, _c])] = i
  12. i += 1
  13. return key
  14.  
  15. key = mapping()
  16. reverse = {v: k for k, v in key.items()}
  17.  
  18. num1 = key["alpha-b-two"]
  19. num2 = key["alpha-a-four"]
  20. print(num1-num2)
  21.  
  22. print(reverse[key["alpha-a-four"] + 3])
  23.  
Success #stdin #stdout 0.03s 9224KB
stdin
Standard input is empty
stdout
3
alpha-b-two