From 8785a72a945db0038840d812c3cd5bacfa2f77a1 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:05:53 +0000 Subject: [PATCH 1/4] updating DIRECTORY.md --- DIRECTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 883b81b2444d..c46d81ab75bc 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -854,6 +854,8 @@ * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_135/sol1.py) * Problem 144 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_144/sol1.py) + * Problem 145 + * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_145/sol1.py) * Problem 173 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_173/sol1.py) * Problem 174 From a94eb535b7ff8a9ad935644bcdebec329b38f1fb Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Thu, 12 May 2022 18:34:46 +0300 Subject: [PATCH 2/4] Improve solution --- project_euler/problem_145/sol1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_euler/problem_145/sol1.py b/project_euler/problem_145/sol1.py index 82e2ea79bc25..ebc721bc9f59 100644 --- a/project_euler/problem_145/sol1.py +++ b/project_euler/problem_145/sol1.py @@ -23,9 +23,9 @@ def odd_digits(num: int) -> bool: >>> odd_digits(135797531) True """ - num_str = str(num) - for i in ["0", "2", "4", "6", "8"]: - if i in num_str: + while num > 0: + digit = num % 10 + if digit % 2 == 0: return False return True From 74b1a9122bcbaf9a5031ae5f712584c1f829e0cb Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Thu, 12 May 2022 15:35:23 +0000 Subject: [PATCH 3/4] updating DIRECTORY.md --- DIRECTORY.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 2094944c25e3..64a87dc660da 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -112,6 +112,7 @@ * [Cnn Classification](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/cnn_classification.py) * [Flip Augmentation](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/flip_augmentation.py) * [Harris Corner](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/harris_corner.py) + * [Horn Schunck](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/horn_schunck.py) * [Mean Threshold](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/mean_threshold.py) * [Mosaic Augmentation](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/mosaic_augmentation.py) * [Pooling Functions](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/pooling_functions.py) @@ -131,6 +132,7 @@ * [Molecular Chemistry](https://github.com/TheAlgorithms/Python/blob/master/conversions/molecular_chemistry.py) * [Octal To Decimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/octal_to_decimal.py) * [Prefix Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions.py) + * [Prefix Conversions String](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions_string.py) * [Pressure Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/pressure_conversions.py) * [Rgb Hsv Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/rgb_hsv_conversion.py) * [Roman Numerals](https://github.com/TheAlgorithms/Python/blob/master/conversions/roman_numerals.py) @@ -529,6 +531,7 @@ * [Perfect Square](https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_square.py) * [Persistence](https://github.com/TheAlgorithms/Python/blob/master/maths/persistence.py) * [Pi Monte Carlo Estimation](https://github.com/TheAlgorithms/Python/blob/master/maths/pi_monte_carlo_estimation.py) + * [Points Are Collinear 3D](https://github.com/TheAlgorithms/Python/blob/master/maths/points_are_collinear_3d.py) * [Pollard Rho](https://github.com/TheAlgorithms/Python/blob/master/maths/pollard_rho.py) * [Polynomial Evaluation](https://github.com/TheAlgorithms/Python/blob/master/maths/polynomial_evaluation.py) * [Power Using Recursion](https://github.com/TheAlgorithms/Python/blob/master/maths/power_using_recursion.py) @@ -619,6 +622,7 @@ * [Tower Of Hanoi](https://github.com/TheAlgorithms/Python/blob/master/other/tower_of_hanoi.py) ## Physics + * [Horizontal Projectile Motion](https://github.com/TheAlgorithms/Python/blob/master/physics/horizontal_projectile_motion.py) * [N Body Simulation](https://github.com/TheAlgorithms/Python/blob/master/physics/n_body_simulation.py) * [Newtons Second Law Of Motion](https://github.com/TheAlgorithms/Python/blob/master/physics/newtons_second_law_of_motion.py) @@ -833,6 +837,8 @@ * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_101/sol1.py) * Problem 102 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_102/sol1.py) + * Problem 104 + * [Sol](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_104/sol.py) * Problem 107 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_107/sol1.py) * Problem 109 @@ -992,6 +998,7 @@ * [Manacher](https://github.com/TheAlgorithms/Python/blob/master/strings/manacher.py) * [Min Cost String Conversion](https://github.com/TheAlgorithms/Python/blob/master/strings/min_cost_string_conversion.py) * [Naive String Search](https://github.com/TheAlgorithms/Python/blob/master/strings/naive_string_search.py) + * [Ngram](https://github.com/TheAlgorithms/Python/blob/master/strings/ngram.py) * [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/strings/palindrome.py) * [Prefix Function](https://github.com/TheAlgorithms/Python/blob/master/strings/prefix_function.py) * [Rabin Karp](https://github.com/TheAlgorithms/Python/blob/master/strings/rabin_karp.py) From cff6a0d0bdefab9a2d18ec557b0962c135e03919 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Fri, 13 May 2022 00:41:34 +0300 Subject: [PATCH 4/4] Fix --- project_euler/problem_145/sol1.py | 1 + 1 file changed, 1 insertion(+) diff --git a/project_euler/problem_145/sol1.py b/project_euler/problem_145/sol1.py index ebc721bc9f59..09d8daff57be 100644 --- a/project_euler/problem_145/sol1.py +++ b/project_euler/problem_145/sol1.py @@ -27,6 +27,7 @@ def odd_digits(num: int) -> bool: digit = num % 10 if digit % 2 == 0: return False + num //= 10 return True