Advertisement
nanokatka

strings-task2

Feb 7th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import sys
  2.  
  3. text=input("Enter text:")
  4. step=input("Enter step (integer):")
  5.  
  6. #first part
  7. print("First implementation gives:",text[::int(step)])
  8.  
  9. #while loop and exit
  10. counter=int(len(text)/int(step))
  11. text2=''
  12. while counter > 0:
  13. text2=text2+text[int(len(text))-counter*int(step)]
  14. counter-=1
  15. continue
  16. sys.exit()
  17. print("second implementation gives:", text2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement