diff --git a/projects/004-avoiding-duplicates/python/main.py b/projects/004-avoiding-duplicates/python/main.py index e69de29b..6f3a26e3 100644 --- a/projects/004-avoiding-duplicates/python/main.py +++ b/projects/004-avoiding-duplicates/python/main.py @@ -0,0 +1,16 @@ +user_list = [] + +user_input = input('insert a string (insert a blank line to stop): ') +while user_input != '': + user_list.append(user_input) + user_input = input('insert a string (insert a blank line to stop): ') + +no_duplicate_list = list(dict.fromkeys(user_list)) + +for words in user_list: + print(words) + +print('') + +for words in no_duplicate_list: + print(words) \ No newline at end of file