Advertisement
mirovlad

Сумиране на гласни букви

May 17th, 2022
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. text = input()
  2.  
  3. y = 0
  4. letters = {
  5.     'a': 1,
  6.     'e': 2,
  7.     'i': 3,
  8.     'o': 4,
  9.     'u': 5
  10. }
  11. for x in text:
  12.     # Така се проверява дали речника letters съдържа индекс x:
  13.     if x in letters
  14.         y = y + letters[x]
  15. print(y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement