Advertisement
tungSfer

slice strings

Jan 16th, 2022
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. def sol():
  2.     s = input()
  3.     print(len(s))
  4.     print(s[-3]+s[-2]+s[-1])
  5.     b = "".join(reversed(s))
  6.     for i in range(0, len(b)):
  7.         if i % 2 == 0:
  8.             print(b[i], end="")
  9.     print()
  10.     for i in range(0, len(s)-2):
  11.         print(s[i], end="")
  12.     print()
  13.     for i in range(0, 5):
  14.         print(s[i], end="")
  15.     print()
  16.     for i in range(0, len(s)):
  17.         if i % 2 == 0:
  18.             print(s[i], end="")
  19.     print()
  20.     for i in range(0, len(s)):
  21.         if i % 2 == 1:
  22.             print(s[i], end="")
  23.     print()
  24.     print(b)
  25.     print(b[1])
  26. if __name__ == "__main__":
  27.     sol()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement