Created
May 29, 2021 12:53
-
-
Save bharathmuddada/0b51985fb2308e8a69224693334d6dde to your computer and use it in GitHub Desktop.
Left Rotate List in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| l=[10,20,30,40] | |
| def leftrotate(l): | |
| s = 1 | |
| e = len(l) - 1 | |
| temp = l[0] | |
| print(l[e]) | |
| while s < len(l): | |
| print(s) | |
| l[s-1] =l[s] | |
| # print(l[s]) | |
| s = s + 1 | |
| l[e] = temp | |
| return l | |
| print(leftrotate(l)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment