Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Programa que pide una frase y cuenta cuantas vocales y cuantas
- # consonantes contiene
- frase = input("Ingrese una frase: ")
- # variables que cuentan cuantas vocales y consonantes hay
- vocales = 0
- consonantes = 0
- for caracter in frase:
- if caracter.lower() in 'aeiou':
- vocales = vocales + 1
- elif caracter.lower() in 'bcdfghjklmnñpqrstvwxyz':
- consonantes = consonantes + 1
- print(f"Hay {vocales} vocales y {consonantes} consonantes")
Advertisement
Add Comment
Please, Sign In to add comment