Kurumo ([info]angrauko) wrote,
Мне кажется с листом неправильно, но на тройку тянет :)
В любом случае, Python я не знаю, но надо полагать для целых чисел это выглядело бы где-то так -
def reverse_int(x)
   result = 0
   while x:
      digit = x % 10
      result = result * 10 + digit
      x = x // 10
   return result

(Тоже ничего interview problem - here is a language you don't know, write some code in it :)


Advertisement


(Read 11 comments)

Post a comment in response:

From:
( )Anonymous - this user has disabled anonymous posting.
( )OpenID Help
Username:
Password:
Don't have an account? Create one now.
Subject:
No HTML allowed in subject
   Help
Message:

 
Notice! This user has turned on the option that logs your IP address when posting. Help
Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…