Skip to content

Instantly share code, notes, and snippets.

@parzibyte

parzibyte/contar.py Secret

Created Oct 19, 2020
Embed
What would you like to do?
cadena = "Hola mundo. Hoy vamos a ver otro ejercicio usando Python"
# Comenzamos convirtiendo a minúsculas, así nos ahorramos comparaciones
cadena_minuscula = cadena.lower()
cantidad_consonantes = 0
for letra in cadena_minuscula:
if letra.isalpha() and not es_vocal(letra):
cantidad_consonantes += 1
print(f"En la cadena '{cadena}' hay {cantidad_consonantes} consonantes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment