| @@ -4,12 +4,6 @@ helper = Helper(debug=True) | |||
| debug = helper.debug | |||
| load_input = helper.load_input | |||
| def is_digit(n): | |||
| try: | |||
| m = int(n) | |||
| except ValueError: | |||
| return False | |||
| return True | |||
| class InputNumber: | |||
| def __init__(self, number, start_pos, end_pos, line): | |||
| @@ -19,7 +13,7 @@ class InputNumber: | |||
| self.line = line | |||
| def _is_symbol(self, char): | |||
| return (char != "." and not is_digit(char)) | |||
| return (char != "." and not char.isdigit()) | |||
| def _check_up(self, input): | |||
| if self.line == 0: | |||
| @@ -81,10 +75,10 @@ def main(): | |||
| for j, line in enumerate(lines): | |||
| i = 0 | |||
| while i < max_len: | |||
| if is_digit(line[i]): | |||
| if line[i].isdigit(): | |||
| current_number = "" | |||
| start_pos = i | |||
| while i < max_len and is_digit(line[i]): | |||
| while i < max_len and line[i].isdigit(): | |||
| current_number += f"{line[i]}" | |||
| i += 1 | |||
| end_pos = i | |||