ramsess90

04. Dict-Ref

Jan 16th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. entrance = input()
  2. my_dict = {}
  3. while entrance.lower() != 'end':
  4.     key = entrance.split(' = ')[0]
  5.     value = entrance.split(' = ')[1]
  6.     if value in my_dict:
  7.         my_dict[key] = my_dict[value]
  8.     elif value.isnumeric():
  9.         my_dict[key] = value
  10.  
  11.     entrance = input()
  12.  
  13. for key, value in my_dict.items():
  14.     print(f'{key} === {value}')
Advertisement
Add Comment
Please, Sign In to add comment