Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The Rotating Digits
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