Вводится набор строк. Найти в нем такие гласные буквы, каждая из которых не входит по крайней мере в одну из заданных строк -Python(Питон)

vowels = { 'a': False, 'e': False, 'o': False, 'i': False, 'u': False }
strs = ('Special', 'cases', 'are', 'not', 'special')
 
for word in strs:
    for vowel in vowels.keys():
        if vowel not in word:
            vowels[vowel] = True
 
for vowel in vowels:
    if vowels[vowel] == True:
        print(vowel)
vowels = [ 'a', 'e', 'o', 'i', 'u' ]
res = []
strs = ('Special', 'cases', 'are', 'not', 'special' )
 
for word in strs:
    res = vowels
    for vowel in vowels:
        if vowel in word:
            res.remove(vowel)
    vowels = res
 
print(res)
VOWELS = 'aeiouy'
 
text = [ 'Jingle bells jingle bells', 'Jingle all the way', 'O what fun it is to ride', 'In a one horse open sleigh' ]
good = set()
 
for v in VOWELS:
    for s in text:
        if not v in s.lower():
            good.add(v)
 
print(sorted(good))
vowels = [ 'a', 'e', 'o', 'i', 'u' ]
res = []
strs = ('Special', 'cases', 'are', 'not', 'special' )
 
for word in strs:
    res = vowels
    for vowel in vowels:
        if vowel in word:
            res.remove(vowel)
    vowels = res
 
print(res)
import re
 
strings = ('Special', 'cases', 'are', 'not', 'special')
vowels = set('aeiou')
 
left = ''.join((re.sub('[^aieou]', '', s) for s in strings))
print(vowels.difference(left))

Leave a Comment