Created
February 26, 2020 16:50
-
-
Save yaraxxx/ef014f520daae9a4ba6e73db29f594ee to your computer and use it in GitHub Desktop.
The Rotating Digits
This file contains 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
2 | |
123 1 | |
489 2 |
This file contains 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
import collections | |
def cal(number , rotaions): | |
numbersList = collections.deque() | |
for d in str(number): | |
numbersList.append(int(d)) | |
numbersList.rotate(int(rotaions)) | |
return numbersList | |
def main(): | |
k = int(input()) | |
for case in range(k): | |
line = input() | |
num , r = line.split() | |
print(case+1,".",end='') | |
numbersList = cal(num,r) | |
for num in numbersList: | |
print(num,end='') | |
print() | |
if __name__=="__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment