Advertisement
aneliabogeva

Rotate List of Strings

Jun 14th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def rightRotate(lists):
  2. last = list[len(list) - 1]
  3.  
  4. for i in range(len(list)-2, -1, -1):
  5. list[i+1] = list[i]
  6.  
  7. list[0] = last
  8.  
  9. values = input()
  10. items = values.split(" ")
  11. list =[]
  12.  
  13. for i in items:
  14. list += [i]
  15.  
  16. rightRotate(list)
  17.  
  18. for j in range(len(list)):
  19. print(list[j], end=' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement