-
-
Save bbookman/7d09a66ffdec60d5a55d167751f64175 to your computer and use it in GitHub Desktop.
''' | |
Create a list of all the consonants in the string "Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams" | |
''' | |
sentence = "Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams" | |
result = [letter for letter in sentence if letter not in 'a,e,i,o,u, " "'] |
vowels_space = ['a', 'e', 'i', 'o', 'u', ' ']
sentence = 'Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams'
my_list = [letter for letter in sentence.lower() if letter not in vowels_space]
sentence = 'Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams'
non_consonants = "aeioau"
consonants = [con for con in sentence.lower() if (con.isalpha() and con not in non_consonants)]
sentence = "Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams"
counting_consonants = [len([digits for digits in sentence if digits != 'a'
or digits != 'e'
or digits != 'o'
or digits != 'u'])]
print(counting_consonants)
print([cons for cons in text_str if cons.strip() and cons not in "aeiou"])
thanks
sentence = "Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams"
consonant = [consonant for consonant in sentence if consonant.lower() not in "aeiou" and consonant !=" "]
print(f"{consonant}")
vowels = "aeıioöuüAEIİOÖUÜ"
text="Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams"
consontants=[i for i in text if i not in vowels]
print(consontants)
result = [x for x in stri.lower() if x not in ['a','e','i','o','u', ' ']]
const_list = [l for l in y_string if l.upper() not in ["A","E","I","O","U"," "]]
I would just propose to transforme the list in a set to have a unique count of each different consonnant :
IN [ ] :
some_string = "Yellow Yaks like yelling and yawning and yesturday they yodled while eating yuky yams"
voyelles = ["a", "e", "i", "o", "u", "y", " "]
consonnant = [c for c in some_string.lower() if c not in voyelles]
print(set(consonnant))
OUT[ ] : {'g', 'r', 'l', 'w', 'd', 'k', 'h', 's', 'm', 't', 'n'}