Advertisement
Olegos

Untitled

Dec 10th, 2020 (edited)
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. # slovo=input("Введите слово: ")
  2. slovo = 'ясень'
  3. glas = ['а','у','о','ы','и','э','ю', 'е','ё','ю','я']
  4. double = ['е','ё','ю','я']
  5. sogl = ['б','в','г','д', 'ж','з','к', 'л','м','н','п','р','с','т','ф','х','ц','ч','ш','щ', 'й']
  6. without = ['ъ','ь']
  7. count=0
  8.  
  9. for i in range(len(slovo)):
  10.  
  11.     if slovo[i] in glas or slovo[i] in sogl:
  12.         count+=1
  13.     if slovo[i] in double:
  14.         if i == 0:
  15.             count+=1
  16.         if slovo[i] == slovo[i-1] and i != 0:
  17.             count+=1
  18.         if slovo[i-1] in glas and i != 0:
  19.             count+=1
  20.         if slovo[i-1] in without and i != 0:
  21.             count+=1
  22.     if slovo[i] in sogl:
  23.         if slovo[i]==slovo[i-1] and i != 0:
  24.             count-=1
  25.     print(slovo[i], i, count)
  26. print ("Количество букв: ",len(slovo))
  27. print ("Количество звуков: ",count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement