pls, can anybody help?
I try to print words which contains forbidden letters but counting without them and excluding the words which has the smallest number of letters.
words = 'hello this is my test'
forbidden = 'h, t, e'
1. hello this test -> these word contains forbidden letters
2. if I exclude the forbidden letters from these words, I will get -> llo is s
(it's important that 'llo' 'is' 's' corresponts to one separate string)
3. finaly I will print the words -> hello this
(excluding test because it contains just one letter s)
point first it's done
point two -> I need help
point three -> not started yet
point first: def small(): words = 'hello, this is my test' forbidden = 'l, h, e' for word in words.split(): for letter in word: if letter in forbidden: print word break continue small()
point two: I did something but problem is that string is together which will be problem in point three. I need to have it separately.
def small(): words = 'hello, this is my test' forbidden = 'l, h, e' a = '' for word in words.split(): for letter in word: if letter in forbidden: letter = '' else: a = a + letter print a, small()
Edited 6 Years Ago by vlady: n/a