DiYane

Search

Jul 28th, 2023
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. n = int(input())
  2. word = input()
  3. words_list = []
  4.  
  5. for i in range(n):
  6.     string_input = input()
  7.     words_list.append(string_input)
  8. print(words_list)
  9.  
  10. for i in range(len(words_list) - 1, -1, -1):
  11.     string_element = words_list[i]
  12.     if word not in string_element:
  13.         words_list.remove(string_element)
  14. print(words_list)
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment