Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 02 Lists Exam Preparation ll 100/100
- # https://judge.softuni.org/Contests/Practice/Index/1578#1
- data = input()
- unique_nums = []
- non_unique_nums = []
- while not data == 'stop playing':
- while ' ' in data:
- data = data.replace(' ', " ")
- data = data.split(' ')
- new_data = []
- for index, el in enumerate(data):
- if el != "":
- data[index] = el.strip()
- new_data.append(int(data[index]))
- if len(new_data) == len(set(new_data)):
- for index, el in enumerate(new_data):
- if el % 2 == 0:
- unique_nums.append(el + 2)
- else:
- unique_nums.append(el)
- print(f"Unique list: {','.join([str(x) for x in sorted(unique_nums)])}")
- output = (sum(unique_nums) / len(unique_nums))
- print(f"Output: {output:.2f}")
- unique_nums.clear()
- else:
- for index, el in enumerate(new_data):
- if not el % 2 == 0:
- non_unique_nums.append(el + 3)
- else:
- non_unique_nums.append(el)
- print(f"Non-unique list: {':'.join([str(x) for x in sorted(non_unique_nums)])}")
- output = (sum(non_unique_nums) / len(non_unique_nums))
- print(f"Output: {output:.2f}")
- non_unique_nums.clear()
- data = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement