|
1 |
| -from __future__ import division |
2 | 1 | from itertools import chain
|
3 | 2 | from math import log10, floor, ceil
|
4 | 3 |
|
5 | 4 |
|
6 | 5 | def largest(min_factor, max_factor):
|
7 |
| - return get_extreme_palindrome_with_factors(max_factor, min_factor, |
8 |
| - "largest") |
| 6 | + return get_extreme_palindrome_with_factors(max_factor, min_factor, "largest") |
9 | 7 |
|
10 | 8 |
|
11 | 9 | def smallest(max_factor, min_factor):
|
12 |
| - return get_extreme_palindrome_with_factors(max_factor, min_factor, |
13 |
| - "smallest") |
| 10 | + return get_extreme_palindrome_with_factors(max_factor, min_factor, "smallest") |
14 | 11 |
|
15 | 12 |
|
16 | 13 | def get_extreme_palindrome_with_factors(max_factor, min_factor, extreme):
|
@@ -53,10 +50,7 @@ def palindromes(max_factor, min_factor, reverse=False):
|
53 | 50 | most of the palindromes just to find the one it needs.
|
54 | 51 | """
|
55 | 52 | if max_factor < min_factor:
|
56 |
| - raise ValueError("invalid input: min is {min_factor} " |
57 |
| - "and max is {max_factor}" |
58 |
| - .format(min_factor=min_factor, |
59 |
| - max_factor=max_factor)) |
| 53 | + raise ValueError("min must be <= max") |
60 | 54 |
|
61 | 55 | minimum = min_factor ** 2
|
62 | 56 | maximum = max_factor ** 2
|
|
0 commit comments