Last active
April 17, 2022 14:55
-
-
Save a1exDi/13e0bd8a51955dd097ec57a94c5b0b0a to your computer and use it in GitHub Desktop.
Убрать дубликаты из list и записать значения в новый list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Задача Яндекс.Практикум, факультет Data Science | |
# В списке yellow_submarine_chorus некоторые значения повторяются. | |
# Создайте список yellow_submarine_briefly, в котором каждый элемент исходного списка встречается только раз. | |
yellow_submarine_chorus = ['we', 'all', 'live', 'in', 'a', 'yellow', 'submarine', 'yellow', 'submarine', 'yellow', 'submarine', 'we', 'all', 'live', 'in', 'a', 'yellow', 'submarine', 'yellow', 'submarine', 'yellow', 'submarine'] | |
yellow_submarine_briefly = [] | |
# ваш код здесь | |
for i in yellow_submarine_chorus: | |
if i not in yellow_submarine_briefly: | |
yellow_submarine_briefly.append(i) | |
print(yellow_submarine_briefly) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment