Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = input()
- my_dict = {}
- while data != "end":
- data = data.split(" -> ")
- key = data[0]
- other_data = data[1].split(", ")
- try:
- test = float(other_data[0])
- if key not in my_dict:
- my_dict[key] = []
- my_dict[key].extend(other_data)
- """"if we replace lines 25-27 with the following line:
- my_dict[key] = my_dict.get(key, []) + other_data
- Judge - 100/100, else 60/100"""
- except ValueError:
- if data[1] in my_dict:
- my_dict[key] = my_dict[data[1]]
- data = input()
- for key, value in my_dict.items():
- print(f"{key} === " + ", ".join(value))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement