title: 5 Ways To Improve Any Function in Python Source: [this Indently video](https://www.youtube.com/watch?v=7m_jcy_CR7w) * Meaningful name * Type annotations * Documentation * Validation of parameters passed in * Prioritise readability ```py def vowels(text): return sum(char.lower() in 'aeiou' for char in text) # 1 meaningful name def count_vowels(text): ... # 2 add type annotations def count_vowels(text: str) -> int: ... # 3 documentation def count_vowels(text: str) -> int: """ Counts vowels in text :param text: ... :return: ... """ # 4 validation def count_vowels(text: str) -> int: """ ... """ if not isistnace(text,str): raise TypeError(f"Please only use strings, {type(text)} is not a valid type") ... # 5 Prioritise readability def count_vowels(text: str) -> int: ... num_vowels = 0 for char in text: if char.lower() in "aeiou": num_vowels += 1 return num_vowels ```