From e3ca8d8de79ed1045516dc030da6cb5b732e32c1 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:01:26 -0800 Subject: [PATCH 1/6] Find the in-between point --- kyu_6/find_the_in_between_point/README.md | 12 +++ kyu_6/find_the_in_between_point/__init__.py | 1 + kyu_6/find_the_in_between_point/solution.py | 45 +++++++++++ .../test_middle_point.py | 79 +++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 kyu_6/find_the_in_between_point/README.md create mode 100644 kyu_6/find_the_in_between_point/__init__.py create mode 100644 kyu_6/find_the_in_between_point/solution.py create mode 100644 kyu_6/find_the_in_between_point/test_middle_point.py diff --git a/kyu_6/find_the_in_between_point/README.md b/kyu_6/find_the_in_between_point/README.md new file mode 100644 index 00000000000..a90d075cf12 --- /dev/null +++ b/kyu_6/find_the_in_between_point/README.md @@ -0,0 +1,12 @@ +# Find the in-between point + +## Description + +For this kata, you are given three points `(x1,y1,z1), (x2,y2,z2), +and (x3,y3,z3)` that lie on a straight line in 3-dimensional space. +You have to figure out which point lies in between the other two. + +Your function should return `1, 2, or 3` to indicate which point is +the in-between one. + +[Source](https://www.codewars.com/kata/58a672d6426bf38be4000057) \ No newline at end of file diff --git a/kyu_6/find_the_in_between_point/__init__.py b/kyu_6/find_the_in_between_point/__init__.py new file mode 100644 index 00000000000..c33c1593cfc --- /dev/null +++ b/kyu_6/find_the_in_between_point/__init__.py @@ -0,0 +1 @@ +"""Find the in-between point.""" diff --git a/kyu_6/find_the_in_between_point/solution.py b/kyu_6/find_the_in_between_point/solution.py new file mode 100644 index 00000000000..03c0dd5f41e --- /dev/null +++ b/kyu_6/find_the_in_between_point/solution.py @@ -0,0 +1,45 @@ +""" +Solution for -> Find the in-between point. + +Created by Egor Kostan. +GitHub: https://github.com/ikostan +""" + +import math + + +def middle_point(*args) -> int: + """ + Return 1, 2, or 3 to indicate which point is the in-between one. + + :param args: 3 sets of 3D coordinates. + :return: int, middle point. + """ + # Set 3D coordinates + a: tuple = args[0][:3] + b: tuple = args[0][3:6] + c: tuple = args[0][6:] + + # Calculate distances + a_b: float = distance_between_two_points(a, b) + a_c: float = distance_between_two_points(a, c) + b_c: float = distance_between_two_points(b, c) + + if a_c < b_c and a_b < b_c: + return 1 + + if a_b < a_c and b_c < a_c: + return 2 + + return 3 + + +def distance_between_two_points(a: tuple, b: tuple) -> float: + """ + Return distance between two points on a 3D coordinate. + + :param a: tuple + :param b: tuple + :return: float + """ + return math.sqrt((b[2] - a[2]) ** 2 + (b[1] - a[1]) ** 2 + (b[0] - a[0]) ** 2) diff --git a/kyu_6/find_the_in_between_point/test_middle_point.py b/kyu_6/find_the_in_between_point/test_middle_point.py new file mode 100644 index 00000000000..5cdf665c81f --- /dev/null +++ b/kyu_6/find_the_in_between_point/test_middle_point.py @@ -0,0 +1,79 @@ +""" +Solution for -> Find the in-between point. + +Created by Egor Kostan. +GitHub: https://github.com/ikostan +""" + +# FUNDAMENTALS GEOMETRY MATHEMATICS ALGORITHMS + +import unittest +import allure +from parameterized import parameterized +from utils.log_func import print_log +from kyu_6.find_the_in_between_point.solution import middle_point + + +# pylint: disable-msg=R0801 +@allure.epic('6 kyu') +@allure.parent_suite('Novice') +@allure.suite("Fundamentals") +@allure.sub_suite("Unit Tests") +@allure.feature("Algorithms") +@allure.story('Find the in-between point') +@allure.tag('FUNDAMENTALS', + 'GEOMETRY', + 'MATHEMATICS', + 'ALGORITHMS') +@allure.link( + url='https://www.codewars.com/kata/58a672d6426bf38be4000057', + name='Source/Kata') +# pylint: enable-msg=R0801 +class MiddlePointTestCase(unittest.TestCase): + """Test 'middle_point' function.""" + + @parameterized.expand([ + ((1, 2, 3, 4, 5, 6, 7, 8, 9), 2, + "Wrong point!"), + ((0, 2, 0, 6, -2, 8, 3, 0, 4), 3, + "Wrong point!"), + ((0.25, 0.50, 0.75, 3.25, -0.50, -0.25, 1.00, 0.25, 0.50), 3, + "Wrong point!"), + ((1, 0, 4, 5, 0, 6, -7, 0, 0), 1, + "Wrong point!"), + ((-1, 0, 2, -2, 4, -1, -3, 8, -4), 2, + "Wrong point!")]) + def test_middle_point(self, coords, expected, err): + """ + Test 'middle_point' function with various test data. + + :param coords: + :param expected: + :param err: + :return: + """ + # pylint: disable-msg=R0801 + allure.dynamic.title("Testing 'middle_point' function") + allure.dynamic.severity(allure.severity_level.NORMAL) + allure.dynamic.description_html( + '
"
+ "Given three points that lie on a straight line in "
+ "3-dimensional space:"
+ "- (x1,y1,z1)
"
+ "- (x2,y2,z2)
"
+ "- (x3,y3,z3)"
+ "
" + "Function should return 1, 2, or 3 to indicate which " + "point is the in-between one." + "
") + # pylint: enable-msg=R0801 + result = middle_point(coords) + with allure.step(f"Enter test data: {coords} " + f"and verify the expected output: {expected}."): + print_log(coords=coords, expected=expected, result=result, err=err) + self.assertEqual(expected, result) From 3fe07fc9acbd207819f5a24160166314241b9eb7 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:05:58 -0800 Subject: [PATCH 2/6] Update README.md --- kyu_6/README.md | 83 +++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/kyu_6/README.md b/kyu_6/README.md index 5382710c6e4..34a227c647c 100644 --- a/kyu_6/README.md +++ b/kyu_6/README.md @@ -15,46 +15,47 @@ rank - the harder the kata the faster you advance. ### List of Completed Kata (Python 3) -| No. | Puzzle/Kata Name | Solution / GitHub Link | -|-----|:---------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------| -| 1 | [Character frequency](https://www.codewars.com/kata/53e895e28f9e66a56900011a) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/character_frequency) | -| 2 | [Count letters in string](https://www.codewars.com/kata/5808ff71c7cfa1c6aa00006d) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/count_letters_in_string) | -| 3 | [Duplicate Encoder](https://www.codewars.com/kata/54b42f9314d9229fd6000d9c) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/duplicate_encoder) | -| 4 | [Find the odd int](https://www.codewars.com/kata/54da5a58ea159efa38000836) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/find_the_odd_int) | -| 5 | [First character that repeats](https://www.codewars.com/kata/54f9f4d7c41722304e000bbb) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/first_character_that_repeats) | -| 6 | [Character with longest consecutive repetition](https://www.codewars.com/kata/586d6cefbcc21eed7a001155) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/longest_repetition) | -| 7 | [Numericals of a String](https://www.codewars.com/kata/5b4070144d7d8bbfe7000001) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/numericals_of_string) | -| 8 | [Permute a Palindrome](https://www.codewars.com/kata/58ae6ae22c3aaafc58000079) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/permute_a_palindrome) | -| 9 | [Pyramid Array](https://www.codewars.com/kata/515f51d438015969f7000013) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/pyramid_array) | -| 10 | [String subpattern recognition I](https://www.codewars.com/kata/5a49f074b3bfa89b4c00002b) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_subpattern_recognition_1) | -| 11 | [String subpattern recognition II](https://www.codewars.com/kata/5a4a391ad8e145cdee0000c4) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_subpattern_recognition_2) | -| 12 | [String subpattern recognition III](https://www.codewars.com/kata/5a4a2973d8e14586c700000a) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_subpattern_recognition_3) | -| 13 | [String transformer](https://www.codewars.com/kata/5878520d52628a092f0002d0) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_transformer) | -| 14 | [Unique In Order](https://www.codewars.com/kata/54e6533c92449cc251001667) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/unique_in_order) | -| 15 | [Vasya - Clerk](https://www.codewars.com/kata/555615a77ebc7c2c8a0000b8) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/vasya_clerk) | -| 16 | [Multiples of 3 or 5](https://www.codewars.com/kata/514b92a657cdc65150000006) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/multiples_of_3_or_5) | -| 17 | [Sum of Digits / Digital Root](https://www.codewars.com/kata/541c8630095125aba6000c00) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/sum_of_digits_digital_root) | -| 18 | [Binary to Text (ASCII) Conversion](https://www.codewars.com/kata/5583d268479559400d000064) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/binary_to_text_ascii_conversion) | -| 19 | [Casino chips](https://www.codewars.com/kata/5e0b72d2d772160011133654) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/casino_chips) | -| 20 | [Pokemon Damage Calculator](https://www.codewars.com/kata/536e9a7973130a06eb000e9f) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/pokemon_damage_calculator) | -| 21 | [Help the bookseller !](https://www.codewars.com/kata/54dc6f5a224c26032800005c) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/help_the_bookseller) | -| 22 | [Row of the odd triangle](https://www.codewars.com/kata/5d5a7525207a674b71aa25b5) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/row_of_the_odd_triangle) | -| 23 | [Disease Spread](https://www.codewars.com/kata/566543703c72200f0b0000c9) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/disease_spread) | -| 24 | [A Rule of Divisibility by 13](https://www.codewars.com/kata/564057bc348c7200bd0000ff) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/a_rule_of_divisibility_by_13) | -| 25 | [Color Choice](https://www.codewars.com/kata/55be10de92aad5ef28000023) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/color_choice) | -| 26 | [DefaultList](https://www.codewars.com/kata/5e882048999e6c0023412908) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/default_list) | -| 27 | [Easy Diagonal](https://www.codewars.com/kata/559b8e46fa060b2c6a0000bf) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/easy_diagonal) | -| 28 | [Array to HTML table](https://www.codewars.com/kata/5e7e4b7cd889f7001728fd4a) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/array_to_html_table) | -| 29 | [rotate the letters of each element](https://www.codewars.com/kata/5e98712b7de14f0026ef1cc1) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/rotate_the_letters_of_each_element) | -| 30 | [Number Zoo Patrol](https://www.codewars.com/kata/5276c18121e20900c0000235) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/number_zoo_patrol) | -| 31 | [Your order, please](https://www.codewars.com/kata/55c45be3b2079eccff00010f) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/your_order_please) | -| 32 | [Who likes it?](https://www.codewars.com/kata/5266876b8f4bf2da9b000362) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/who_likes_it) | -| 33 | [Encrypt this!](https://www.codewars.com/kata/5848565e273af816fb000449) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/encrypt_this) | -| 34 | [Decipher this!](https://www.codewars.com/kata/decipher-this) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/decipher_this) | -| 35 | [Format a string of names like 'Bart, Lisa & Maggie'.](https://www.codewars.com/kata/53368a47e38700bd8300030d) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/format_string_of_names) | -| 36 | [Sort the odd](https://www.codewars.com/kata/578aa45ee9fd15ff4600090d) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/sort_the_odd) | -| 37 | [Array.diff](https://www.codewars.com/kata/523f5d21c841566fde000009) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/array_diff) | -| 38 | [Scheduling](https://www.codewars.com/kata/550cc572b9e7b563be00054f) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/scheduling ) | -| 39 | [Sums of Parts](https://www.codewars.com/kata/5ce399e0047a45001c853c2b) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/sums_of_parts ) | +| No. | Puzzle/Kata Name | Solution / GitHub Link | +|-----|:---------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------:| +| 1 | [Character frequency](https://www.codewars.com/kata/53e895e28f9e66a56900011a) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/character_frequency) | +| 2 | [Count letters in string](https://www.codewars.com/kata/5808ff71c7cfa1c6aa00006d) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/count_letters_in_string) | +| 3 | [Duplicate Encoder](https://www.codewars.com/kata/54b42f9314d9229fd6000d9c) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/duplicate_encoder) | +| 4 | [Find the odd int](https://www.codewars.com/kata/54da5a58ea159efa38000836) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/find_the_odd_int) | +| 5 | [First character that repeats](https://www.codewars.com/kata/54f9f4d7c41722304e000bbb) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/first_character_that_repeats) | +| 6 | [Character with longest consecutive repetition](https://www.codewars.com/kata/586d6cefbcc21eed7a001155) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/longest_repetition) | +| 7 | [Numericals of a String](https://www.codewars.com/kata/5b4070144d7d8bbfe7000001) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/numericals_of_string) | +| 8 | [Permute a Palindrome](https://www.codewars.com/kata/58ae6ae22c3aaafc58000079) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/permute_a_palindrome) | +| 9 | [Pyramid Array](https://www.codewars.com/kata/515f51d438015969f7000013) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/pyramid_array) | +| 10 | [String subpattern recognition I](https://www.codewars.com/kata/5a49f074b3bfa89b4c00002b) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_subpattern_recognition_1) | +| 11 | [String subpattern recognition II](https://www.codewars.com/kata/5a4a391ad8e145cdee0000c4) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_subpattern_recognition_2) | +| 12 | [String subpattern recognition III](https://www.codewars.com/kata/5a4a2973d8e14586c700000a) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_subpattern_recognition_3) | +| 13 | [String transformer](https://www.codewars.com/kata/5878520d52628a092f0002d0) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/string_transformer) | +| 14 | [Unique In Order](https://www.codewars.com/kata/54e6533c92449cc251001667) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/unique_in_order) | +| 15 | [Vasya - Clerk](https://www.codewars.com/kata/555615a77ebc7c2c8a0000b8) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/vasya_clerk) | +| 16 | [Multiples of 3 or 5](https://www.codewars.com/kata/514b92a657cdc65150000006) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/multiples_of_3_or_5) | +| 17 | [Sum of Digits / Digital Root](https://www.codewars.com/kata/541c8630095125aba6000c00) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/sum_of_digits_digital_root) | +| 18 | [Binary to Text (ASCII) Conversion](https://www.codewars.com/kata/5583d268479559400d000064) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/binary_to_text_ascii_conversion) | +| 19 | [Casino chips](https://www.codewars.com/kata/5e0b72d2d772160011133654) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/casino_chips) | +| 20 | [Pokemon Damage Calculator](https://www.codewars.com/kata/536e9a7973130a06eb000e9f) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/pokemon_damage_calculator) | +| 21 | [Help the bookseller !](https://www.codewars.com/kata/54dc6f5a224c26032800005c) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/help_the_bookseller) | +| 22 | [Row of the odd triangle](https://www.codewars.com/kata/5d5a7525207a674b71aa25b5) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/row_of_the_odd_triangle) | +| 23 | [Disease Spread](https://www.codewars.com/kata/566543703c72200f0b0000c9) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/disease_spread) | +| 24 | [A Rule of Divisibility by 13](https://www.codewars.com/kata/564057bc348c7200bd0000ff) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/a_rule_of_divisibility_by_13) | +| 25 | [Color Choice](https://www.codewars.com/kata/55be10de92aad5ef28000023) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/color_choice) | +| 26 | [DefaultList](https://www.codewars.com/kata/5e882048999e6c0023412908) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/default_list) | +| 27 | [Easy Diagonal](https://www.codewars.com/kata/559b8e46fa060b2c6a0000bf) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/easy_diagonal) | +| 28 | [Array to HTML table](https://www.codewars.com/kata/5e7e4b7cd889f7001728fd4a) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/array_to_html_table) | +| 29 | [rotate the letters of each element](https://www.codewars.com/kata/5e98712b7de14f0026ef1cc1) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/rotate_the_letters_of_each_element) | +| 30 | [Number Zoo Patrol](https://www.codewars.com/kata/5276c18121e20900c0000235) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/number_zoo_patrol) | +| 31 | [Your order, please](https://www.codewars.com/kata/55c45be3b2079eccff00010f) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/your_order_please) | +| 32 | [Who likes it?](https://www.codewars.com/kata/5266876b8f4bf2da9b000362) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/who_likes_it) | +| 33 | [Encrypt this!](https://www.codewars.com/kata/5848565e273af816fb000449) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/encrypt_this) | +| 34 | [Decipher this!](https://www.codewars.com/kata/decipher-this) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/decipher_this) | +| 35 | [Format a string of names like 'Bart, Lisa & Maggie'.](https://www.codewars.com/kata/53368a47e38700bd8300030d) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/format_string_of_names) | +| 36 | [Sort the odd](https://www.codewars.com/kata/578aa45ee9fd15ff4600090d) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/sort_the_odd) | +| 37 | [Array.diff](https://www.codewars.com/kata/523f5d21c841566fde000009) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/array_diff) | +| 38 | [Scheduling](https://www.codewars.com/kata/550cc572b9e7b563be00054f) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/scheduling) | +| 39 | [Sums of Parts](https://www.codewars.com/kata/5ce399e0047a45001c853c2b) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/sums_of_parts) | +| 40 | [Find the in-between point](https://www.codewars.com/kata/58a672d6426bf38be4000057) | [Solution](https://github.com/ikostan/codewars/tree/master/kyu_6/find_the_in_between_point) | [Source](https://www.codewars.com/about) \ No newline at end of file From ac5a6b5b051d65e5589789c07cd95c6850894c17 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:06:56 -0800 Subject: [PATCH 3/6] Create kyu_6.find_the_in_between_point.rst --- docs/kyu_6.find_the_in_between_point.rst | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 docs/kyu_6.find_the_in_between_point.rst diff --git a/docs/kyu_6.find_the_in_between_point.rst b/docs/kyu_6.find_the_in_between_point.rst new file mode 100644 index 00000000000..1825e790ad8 --- /dev/null +++ b/docs/kyu_6.find_the_in_between_point.rst @@ -0,0 +1,32 @@ +kyu\_6.find\_the\_in\_between\_point package +============================================ + +Submodules +---------- + +kyu\_6.find\_the\_in\_between\_point.solution module +---------------------------------------------------- + +.. automodule:: kyu_6.find_the_in_between_point.solution + :members: + :undoc-members: + :show-inheritance: + :private-members: + +kyu\_6.find\_the\_in\_between\_point.test\_middle\_point module +--------------------------------------------------------------- + +.. automodule:: kyu_6.find_the_in_between_point.test_middle_point + :members: + :undoc-members: + :show-inheritance: + :private-members: + +Module contents +--------------- + +.. automodule:: kyu_6.find_the_in_between_point + :members: + :undoc-members: + :show-inheritance: + :private-members: From 59d78762dd0a45e10e031af4e10c8bdffa19ca42 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:10:08 -0800 Subject: [PATCH 4/6] Docs --- docs/kyu_6/kyu_6.find_the_in_between_point.module.rst | 11 +++++++++++ docs/kyu_6/kyu_6.find_the_in_between_point.readme.rst | 5 +++++ docs/{ => kyu_6}/kyu_6.find_the_in_between_point.rst | 0 docs/kyu_6/kyu_6.rst | 1 + 4 files changed, 17 insertions(+) create mode 100644 docs/kyu_6/kyu_6.find_the_in_between_point.module.rst create mode 100644 docs/kyu_6/kyu_6.find_the_in_between_point.readme.rst rename docs/{ => kyu_6}/kyu_6.find_the_in_between_point.rst (100%) diff --git a/docs/kyu_6/kyu_6.find_the_in_between_point.module.rst b/docs/kyu_6/kyu_6.find_the_in_between_point.module.rst new file mode 100644 index 00000000000..572c035a2ae --- /dev/null +++ b/docs/kyu_6/kyu_6.find_the_in_between_point.module.rst @@ -0,0 +1,11 @@ +kyu\_6.find\_the\_in\_between\_point.module package +=================================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + kyu_6.find_the_in_between_point.readme + kyu_6.find_the_in_between_point \ No newline at end of file diff --git a/docs/kyu_6/kyu_6.find_the_in_between_point.readme.rst b/docs/kyu_6/kyu_6.find_the_in_between_point.readme.rst new file mode 100644 index 00000000000..d997242a11b --- /dev/null +++ b/docs/kyu_6/kyu_6.find_the_in_between_point.readme.rst @@ -0,0 +1,5 @@ +README +====== + +.. include:: ../../kyu_6/find_the_in_between_point/README.md + :parser: myst_parser.sphinx_ \ No newline at end of file diff --git a/docs/kyu_6.find_the_in_between_point.rst b/docs/kyu_6/kyu_6.find_the_in_between_point.rst similarity index 100% rename from docs/kyu_6.find_the_in_between_point.rst rename to docs/kyu_6/kyu_6.find_the_in_between_point.rst diff --git a/docs/kyu_6/kyu_6.rst b/docs/kyu_6/kyu_6.rst index 2aba7122898..b4c4d0b6963 100644 --- a/docs/kyu_6/kyu_6.rst +++ b/docs/kyu_6/kyu_6.rst @@ -22,6 +22,7 @@ Subpackages kyu_6.duplicate_encoder.module kyu_6.easy_diagonal.module kyu_6.encrypt_this.module + kyu_6.find_the_in_between_point.module kyu_6.find_the_odd_int.module kyu_6.first_character_that_repeats.module kyu_6.format_string_of_names.module From 1ed9e3f5cd5bd73a2d569f58747addf1fad14927 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:11:22 -0800 Subject: [PATCH 5/6] Update solution.py --- kyu_6/find_the_in_between_point/solution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kyu_6/find_the_in_between_point/solution.py b/kyu_6/find_the_in_between_point/solution.py index 03c0dd5f41e..a5e5b4c3339 100644 --- a/kyu_6/find_the_in_between_point/solution.py +++ b/kyu_6/find_the_in_between_point/solution.py @@ -31,7 +31,7 @@ def middle_point(*args) -> int: if a_b < a_c and b_c < a_c: return 2 - return 3 + return 3 def distance_between_two_points(a: tuple, b: tuple) -> float: From 11620d184c555af278cbb3eba2b9e07f501c5ac4 Mon Sep 17 00:00:00 2001 From: Egor Kostan <20955183+ikostan@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:32:37 -0800 Subject: [PATCH 6/6] Update kyu_6/find_the_in_between_point/solution.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- kyu_6/find_the_in_between_point/solution.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kyu_6/find_the_in_between_point/solution.py b/kyu_6/find_the_in_between_point/solution.py index a5e5b4c3339..ea92c3772f1 100644 --- a/kyu_6/find_the_in_between_point/solution.py +++ b/kyu_6/find_the_in_between_point/solution.py @@ -28,10 +28,7 @@ def middle_point(*args) -> int: if a_c < b_c and a_b < b_c: return 1 - if a_b < a_c and b_c < a_c: - return 2 - - return 3 + return 2 if a_b < a_c and b_c < a_c else 3 def distance_between_two_points(a: tuple, b: tuple) -> float: