Advertisement
Infiniti_Inter

palindrom

Jun 10th, 2020
1,151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. def isPalidnrom(s):
  2.     l = len(s)
  3.     for i in range(l//2):
  4.         if s[i] != s[-1-i]:
  5.             return False
  6.     return True
  7.  
  8. s = input('введите строку: ')
  9. word = input('введите букву: ')
  10. lst = s.split(',')
  11.  
  12. cnt = 0
  13. for i in lst:
  14.     if (i[0] == word):
  15.         if (isPalidnrom(i)):
  16.                 cnt += 1
  17. print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement