Contar vocales en Python

#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Fer Carraro ''' def vocales(cadena): cadena = cadena.lower() contador = 0 for cad in cadena: if cad in "aeiou": contador += 1 return contador def main(): cadena = "ANITA LAVA LA TINA" print('Cadena: ',cadena) print('Cant. vocales:',vocales(cadena)) if __name__ == '__main__': main()
Contar vocales de un string

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.