refractor: make function work for big numbers too
This commit is contained in:
parent
fd50d5ec9c
commit
e1ad5e8296
@ -1,9 +1,11 @@
|
||||
def doubly_not_less(n):
|
||||
n_int = m = int(n)
|
||||
m_condition = int("".join([str(x) for x in [int(x) for x in n][::-1]]))
|
||||
n_int = int(n)
|
||||
|
||||
while m_condition < n_int:
|
||||
m += 1
|
||||
m_condition = int("".join([x for x in str(m)][::-1]))
|
||||
# function reverses the order of a string of numbers to int
|
||||
reverse = lambda x: int("".join([str(item) for item in [int(x) for x in x][::-1]]))
|
||||
|
||||
return str(m)
|
||||
if reverse(n) >= n_int:
|
||||
return n
|
||||
return None
|
||||
|
||||
print(doubly_not_less("23456"))
|
||||
Loading…
x
Reference in New Issue
Block a user