Skip to content

Instantly share code, notes, and snippets.

@a1exDi
Last active April 17, 2022 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a1exDi/13e0bd8a51955dd097ec57a94c5b0b0a to your computer and use it in GitHub Desktop.
Save a1exDi/13e0bd8a51955dd097ec57a94c5b0b0a to your computer and use it in GitHub Desktop.
Убрать дубликаты из list и записать значения в новый list
# Задача Яндекс.Практикум, факультет 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