+ 20
[ASSIGNMENT] Rotate a Number !
Write a program to input a number and rotate it till it becomes the original number. For example: Input = 139 Output = 139 913 391 139 All programming language are allowed ! Good luck to all !!! :) Aaron Stone. this is my try .. https://code.sololearn.com/ct5ZYdBZcctu/?ref=app
28 Answers
+ 12
Short and Sweet
https://code.sololearn.com/cqE9A5FjPf3C/?ref=app
+ 27
https://code.sololearn.com/c5iNcJzObrez/?ref=app
+ 11
Works with strings and int
https://code.sololearn.com/c3xDnZtb54gA/?ref=app
+ 11
+ 10
+ 10
My code in Web.
https://code.sololearn.com/WyZow9oT9FGz/?ref=app
+ 9
#python..
a=input()
b=1;c=a
print(a)
while int(a)!=b:
b=int(c[-1]+c[:len(c)-1])
print(b)
c=str(b)
+ 7
Hello, everyone!
Here is my code to this challenge.
I chose to write a version treating the input as an integer, and another one treating the input as an string. Please check them out!
And you keep up the hard work!
EDIT: now there is a third version :)
https://code.sololearn.com/c82qSwyyPbhh/
+ 6
Awesome guys !
+ 6
why does nobody do these in c#? :(
https://code.sololearn.com/cFYSD8YfMt7u/?ref=app
+ 6
+ 5
In the interest of learning, I started playing around with collections and came across deque's. Deque has a nice function rotate.
So I made an example using deque collections using rotate.
Read more on collections here:
https://docs.python.org/3.5/library/collections.html#collections.deque
https://code.sololearn.com/csywDBXDcb70/#py
+ 4
https://code.sololearn.com/cBV897XntKPd/?ref=app
+ 4
Here is my attempt ;
although I must say I am really humbled by some of the other replies!
https://code.sololearn.com/c7081MdSGI1N/#py
+ 4
Mine (coded in my phone =( )
https://code.sololearn.com/cPZaS2dtReTD/?ref=app
+ 4
I figured out a new innovative way of rotating a list.
https://code.sololearn.com/cUmbO9x44nFa/?ref=app
+ 3
print(n//10+(n%10)*10**int(log10(n)))