SHARE
TWEET

Untitled

a guest Oct 18th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = input()
  2. ans = 0
  3. digits = '0123456789'
  4. for i in range(len(n)):
  5.  for digit in digits:
  6.  new = int(n[:i] + digit + n[i + 1:])
  7.  if digit != n[i] and new % 3 == 0:
  8.  ans = max(ans, new)
  9. print(ans)
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top