Advertisement
Mofeoluwa

RightWords

Feb 29th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. def right_words(list1,number):
  2.     x = [] #create and empty list
  3.     for i in list1: #loop through the elements in list1
  4.         if len(i) == number: #if the length of any of the elements in list1 is 3
  5.             x.append(i) #add the object to a new list
  6.     print(x) #print x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement