Sabev

Dict-Ref

Jan 16th, 2019
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. reference = {}
  2. entry_list = []
  3. while True:
  4.     string_input = input()
  5.  
  6.     entry_list = string_input.split()
  7.  
  8.     name = entry_list[0]
  9.     if string_input == "end":
  10.         break
  11.     value = entry_list[2]
  12.  
  13.     if ord(value[0]) >= 48 and ord(value[0]) <= 57:
  14.         reference[name] = int(value)
  15.     elif value in reference:
  16.         reference[name] = reference[value]
  17.  
  18. for name in reference:
  19.     print(f"{name} === {reference[name]}")
RAW Paste Data