SHARE
TWEET

python1

a guest Nov 14th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top