teslariu

ej pendiente

Jun 30th, 2023
1,146
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 1 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. total_vocales = 0
  5. total_consonantes = 0
  6.  
  7. frase = input("Ingrese una frase: ")
  8.  
  9. for caracter in frase:
  10.     if caracter.lower() in "aeiou":
  11.         total_vocales += 1
  12.        
  13.     elif caracter.lower() in 'bcdfghjklmnñpqrstvwxyz':
  14.         total_consonantes += 1
  15.    
  16. print(f"Consonantes: {total_consonantes} - Vocales: {total_vocales}")
  17.        
  18.    
Advertisement
Add Comment
Please, Sign In to add comment