+ 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

11th Feb 2018, 6:47 AM
Aaron Stone
Aaron Stone - avatar
28 Answers
11th Feb 2018, 7:47 AM
Louis
Louis - avatar
+ 27
https://code.sololearn.com/c5iNcJzObrez/?ref=app
11th Feb 2018, 7:42 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
13th Feb 2018, 1:58 PM
Prabha_I
Prabha_I - avatar
11th Feb 2018, 10:32 AM
D_Stark
D_Stark - avatar
11th Feb 2018, 11:59 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
11th Feb 2018, 7:05 AM
Oma Falk
Oma Falk - avatar
12th Feb 2018, 12:25 AM
UnknownYmous
+ 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)
11th Feb 2018, 12:41 PM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
11th Feb 2018, 11:24 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 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/
11th Feb 2018, 11:24 PM
Pedro Maimere
Pedro Maimere - avatar
+ 6
Awesome guys !
11th Feb 2018, 7:50 AM
Aaron Stone
Aaron Stone - avatar
+ 6
why does nobody do these in c#? :( https://code.sololearn.com/cFYSD8YfMt7u/?ref=app
11th Feb 2018, 2:44 PM
hinanawi
hinanawi - avatar
12th Feb 2018, 1:15 PM
🐙evil octopus
🐙evil octopus - avatar
+ 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
13th Feb 2018, 10:06 AM
Louis
Louis - avatar
16th Feb 2018, 12:42 AM
Med Arezki
Med Arezki - avatar
+ 4
https://code.sololearn.com/cBV897XntKPd/?ref=app
11th Feb 2018, 1:53 PM
Nashat
Nashat - avatar
+ 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
11th Feb 2018, 5:42 PM
Hamid
Hamid - avatar
+ 4
11th Feb 2018, 10:24 PM
Nitzan
Nitzan - avatar
+ 4
I figured out a new innovative way of rotating a list. https://code.sololearn.com/cUmbO9x44nFa/?ref=app
23rd Apr 2018, 5:23 PM
Louis
Louis - avatar
+ 3
print(n//10+(n%10)*10**int(log10(n)))
11th Feb 2018, 7:58 AM
VcC
VcC - avatar