Advertisement
Adehumble

Week4 Coding Exercise 10

Feb 22nd, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. #10
  2. print("This program is written to return a list of words with at least 5 characters from your choice input")
  3.  
  4. print("|||||"*24)
  5.  
  6.  
  7. #My Function Program
  8. def long_string(expected_string):
  9.     expected_list=[]
  10.     for i in expected_string:
  11.         if len(i)>=5:
  12.             expected_list.append(i)
  13.     print(expected_list)
  14.  
  15. #My Main Program
  16. user_list=[]
  17. while True:
  18.     try:
  19.         num=int(input("How many siblings do you have? "))
  20.         break
  21.     except ValueError:
  22.         print("That is a wrong input.\nPlease, enter a postive integer")
  23.         print("|||||"*24)
  24.        
  25. for n in range(num):
  26.     user_string=input("Enter the names of your siblings: ")
  27.     user_list.append(user_string)
  28.  
  29. long_string(user_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement