Advertisement
Mancolo

Untitled

Oct 14th, 2020
1,928
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. # 1
  2. word = 'abrakadabra'
  3. summ = 0
  4. for i in word:
  5.     if i =='a':
  6.         summ += 1
  7. print(summ)
  8.  
  9. # 2
  10. word = 'abrakadabra'
  11. print(word.replace('ab',''))
  12.  
  13. # 3
  14. word = input('Введите слово: ')
  15. if word == word[::-1]:
  16.     print('Слово является палиндромом:')
  17. else:
  18.     print('Слово не является палиндромом')
  19.  
  20. # 4
  21. word = 'abrakadabra'
  22. s = list(word)
  23. summ = 0
  24. for i in range(len(s)-1):
  25.     if s[i] + s[i+1] == 'ra'
  26.         summ += 1
  27. print(summ)
  28.  
  29. # 5
  30. sent = input('Введите предложение:\n')
  31. print(sent.split())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement