NIKOLAY_TETUS

Untitled

Jun 14th, 2021 (edited)
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. str = ">" + "432" * 100 + "<"
  2.  
  3. #print(str.replace("4", "!", 1))
  4.  
  5. while str.find(">4") or str.find(">3") or str.find(">2") or str.find("4<") or str.find("3<") or str.find("2<"):
  6.     if str.find(">4") or str.find(">3"):
  7.         str = str.replace(">4", "2>3", 1)
  8.         str = str.replace(">3", "1>2", 1)
  9.     else:
  10.         if str.find("4<") or str.find("3<"):
  11.             str = str.replace("4<", "3<2", 1)
  12.             str = str.replace("3<", "2<1", 1)
  13.         else:
  14.             str = str.replace("2>", "0>", 1)
  15.             str = str.replace("2<", "<0", 1)
  16.  
  17. print(str)
  18.  
Add Comment
Please, Sign In to add comment