Advertisement
Guest User

Gergő

a guest
Aug 29th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. Mással_h = ["b", "c", "d", "f", "g", "h", "j",\
  2.             "k", "l", "m", "n", "p", "r", "s",\
  3.             "t", "v", "z","q", "w", "x","y"]
  4. file = open("note.txt","r")
  5. def nice(sor):
  6.     g = 0
  7.     k = 0
  8.     i3 = None
  9.     i2 = None
  10.     sor = sor.strip()
  11.     lista = list(sor)
  12.     while ' ' in lista:
  13.         lista.remove(' ')
  14.     while '.' in lista:
  15.         lista.remove('.')
  16.     while ',' in lista:
  17.         lista.remove(',')
  18.     for i in lista:
  19.         if k >= 2:
  20.             if i3 not in Mással_h and i2 in Mással_h and i in Mással_h:
  21.                 g += 1
  22.         i3 = i2
  23.         i2 = i
  24.         k += 1
  25.     return g
  26. for i in file:
  27.     print(nice(i),'darab van a sorban!')
  28. file.close()
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement