Advertisement
Guest User

python1

a guest
Nov 14th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. a = input()
  2.  
  3. def zadacha__ABab(a) :
  4.     text = ""
  5.     count = 0
  6.  
  7.     for i in range(len(a)):
  8.         if a[i]== "a" :
  9.             text = text + "b"
  10.             count += 1
  11.  
  12.         elif a[i] == "A":
  13.             text = text + "B"
  14.             count += 1
  15.  
  16.         elif a[i] == "b":
  17.             text = text + "a"
  18.             count += 1
  19.  
  20.         elif a[i]=="B":
  21.             text = text + "A"
  22.             count += 1
  23.  
  24.         elif a[i] == "c":
  25.             text = text + "с"
  26.  
  27.         elif a[i] == "C":
  28.             text = text + "C"
  29.  
  30.         else:
  31.             pass
  32.     #text - преобразованный текст
  33.     #count - количество замен
  34.     print(text)
  35.     print(count)
  36.  
  37.  
  38. zadacha__ABab(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement