Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # takes input from the user and only prints out words
- # with a length of 4 or less. Also prints out all substrings of
- # the words
- userInput = raw_input("Please enter a sentence: ")
- for w in userInput.split():
- length = len(w)
- x = 1
- if (len(w) <= 4):
- while (x <= len(w)):
- print w[0:x]
- x = x + 1
Advertisement
Add Comment
Please, Sign In to add comment