from toolset import iterate, quantify, take

def to_digits(num):
    # to_digits(1234) --> [1, 2, 3, 4]
    return list(map(int, str(num)))

def to_num(digits):
    # to_num([1, 2, 3, 4]) --> 1234
    return int(''.join(map(str, digits)))

def is_palindromic(num):
    return to_digits(num) == list(reversed(to_digits(num)))

def is_lychrel(num):
    rev = lambda x: to_num(to_digits(x)[::-1])
    start = num + rev(num)
    iterations = iterate(lambda x: x + rev(x), start)
    return not any(is_palindromic(n) for n in take(50, iterations))

def problem55():
    return quantify(range(1, 10000), pred=is_lychrel)

from toolset import iterate, quantify, take

def to_digits(num):
    # to_digits(1234) --> [1, 2, 3, 4]
    return list(map(int, str(num)))

def to_num(digits):
    # to_num([1, 2, 3, 4]) --> 1234
    return int(''.join(map(str, digits)))

def is_palindromic(num):
    return to_digits(num) == list(reversed(to_digits(num)))

def is_lychrel(num):
    rev = lambda x: to_num(reversed(to_digits(x)))
    start = num + rev(num)
    iterations = iterate(lambda x: x + rev(x), start)
    return not any(is_palindromic(n) for n in take(50, iterations))

def problem55():
    return quantify(range(1, 10000), pred=is_lychrel)

Use clearer function name in is_lychrel
Use clearer function name in is_lychrel

  from toolset import iterate, quantify, take
  
  def to_digits(num):
      # to_digits(1234) --> [1, 2, 3, 4]
      return list(map(int, str(num)))
  
  def to_num(digits):
      # to_num([1, 2, 3, 4]) --> 1234
      return int(''.join(map(str, digits)))
  
  def is_palindromic(num):
      return to_digits(num) == list(reversed(to_digits(num)))
  
  def is_lychrel(num):
-     rev = lambda x: to_num(to_digits(x)[::-1])
+     rev = lambda x: to_num(reversed(to_digits(x)))
      start = num + rev(num)
      iterations = iterate(lambda x: x + rev(x), start)
      return not any(is_palindromic(n) for n in take(50, iterations))
  
  def problem55():
      return quantify(range(1, 10000), pred=is_lychrel)
  
Use clearer function name in is_lychrel
## Code Before:
from toolset import iterate, quantify, take

def to_digits(num):
    # to_digits(1234) --> [1, 2, 3, 4]
    return list(map(int, str(num)))

def to_num(digits):
    # to_num([1, 2, 3, 4]) --> 1234
    return int(''.join(map(str, digits)))

def is_palindromic(num):
    return to_digits(num) == list(reversed(to_digits(num)))

def is_lychrel(num):
    rev = lambda x: to_num(to_digits(x)[::-1])
    start = num + rev(num)
    iterations = iterate(lambda x: x + rev(x), start)
    return not any(is_palindromic(n) for n in take(50, iterations))

def problem55():
    return quantify(range(1, 10000), pred=is_lychrel)

## Instruction:
Use clearer function name in is_lychrel
## Code After:
from toolset import iterate, quantify, take

def to_digits(num):
    # to_digits(1234) --> [1, 2, 3, 4]
    return list(map(int, str(num)))

def to_num(digits):
    # to_num([1, 2, 3, 4]) --> 1234
    return int(''.join(map(str, digits)))

def is_palindromic(num):
    return to_digits(num) == list(reversed(to_digits(num)))

def is_lychrel(num):
    rev = lambda x: to_num(reversed(to_digits(x)))
    start = num + rev(num)
    iterations = iterate(lambda x: x + rev(x), start)
    return not any(is_palindromic(n) for n in take(50, iterations))

def problem55():
    return quantify(range(1, 10000), pred=is_lychrel)
