string - Check presence of Vowels in word, python -
I have to check whether a vowel is present in one word or not. If so, then an operation should be taken out of the word (open word). I want to avoid the loop because I thought about it:
In four words: if char 'aeiou': #confused here ... Please recommend a method that comes to execution time, then the cost is low. Apart from this, help me improve the above approach too.
vowel = {"a", "e if any "I", "A", "E", "I", "O", "U"}: ... Note: This is better because it is a short circuit, as soon as the word is received in the word, therefore, all characters do not have to check in unless there is no tone in the string. Edit: went and found, that is very fast, but with some adaptation, again Runt beats everything. Import = "" A "," E "," I "," O "," U "," A "," E " "I", "O", "U"} pattern = recompile ("[AEUUUUU]") Def intersection (): Return boole (vowels.intersection ("TWYNDYLLYNGS")) DEF any_version (): any ("TWYNDYLLYNGS Returns ("TWYNDYLLYNGS") print timetable ("reversion"), for "return vowels" ("TWYNDYLLYNGS")) Def dissection (): "Return" From "," Import from time to time "period from time to time Print time table ("decomposed ()", "__main__ import dissection", print time ("any_version ()", "__ <__ main__ import re_version, vowel"), "intersection ()", "__-man_ import intersection, From, vowel ")
Comments
Post a Comment