daily pastebin goal
24%
SHARE
TWEET

eso

a guest Apr 7th, 2018 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def menorver(m):
  2.   if m>0:
  3.     num=str(m)
  4.     if len(num)>1:
  5.       for j in range(len(num)):
  6.         last=num[-1]
  7.         rest=num[0:len(num)-1]
  8.         new_num=last+rest
  9.         new=int(new_num)
  10.         if new < int(num):
  11.           num=str(new)
  12.       num=int(num)
  13.   elif m<0:
  14.     b=abs(m)
  15.     num=str(b)
  16.     if len(num)>1:
  17.       for j in range(len(num)):
  18.         last=num[-1]
  19.         rest=num[0:len(num)-1]
  20.         new_num=last+rest
  21.         new=int(new_num)
  22.         if new > int(num):
  23.           num=str(new)
  24.       num=-(int(num))
  25.   if m==0:
  26.     return m
  27.   return num
  28.  
  29. n=input("")
  30. ls=[]
  31. for i in range(n):
  32.  ls.append(input(""))
  33. for k in ls:
  34.   print menorver(k)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top