From dd23d63d638a51dde1c76f6c9a966fedd9392657 Mon Sep 17 00:00:00 2001 From: Elena Varbanova Date: Sun, 17 Oct 2021 21:40:36 +0300 Subject: [PATCH 1/8] added files in gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f4158ed..89a918c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ materials/**/*.html +.DS_Store From d2499726d865b9b9da96fd556d5e551380cdb17d Mon Sep 17 00:00:00 2001 From: elenavarbanova <48411601+elenavarbanova@users.noreply.github.com> Date: Mon, 29 Nov 2021 12:13:23 +0200 Subject: [PATCH 2/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c42903..d4df908 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ $ marp 01.md && open 01.html |6| Валентин Найденов| [valentinmnaydenov](https://github.com/valentinmnaydenov) | | | |7| Данаил Божков | [DBozhkovV](https://github.com/DBozhkovV) | | | |8| Даниел Паунов | [McAwesome123](https://github.com/McAwesome123) | | | -|9| Елена Върбанова | [elenavarbanova](https://github.com/elenavarbanova) | | | +|9| Елена Върбанова | [elenavarbanova](https://github.com/elenavarbanova) | 🍬 | | |10| Златина Лилова | [zlatililova](https://github.com/zlatililova) | | | |11| Иваело Кръстев | [Ivaelo](https://github.com/Ivaelo) | | | |12| Ивайло Димов | [IvailoDimov](https://github.com/IvailoDimov) | | | From 2545f30f41f32ddf277236c1e8977418e4eda687 Mon Sep 17 00:00:00 2001 From: elenavarbanova <48411601+elenavarbanova@users.noreply.github.com> Date: Thu, 2 Dec 2021 09:56:47 +0200 Subject: [PATCH 3/8] Update .gitignore --- .gitignore | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.gitignore b/.gitignore index e557a93..589f489 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,3 @@ -<<<<<<< HEAD -materials/**/*.html -.DS_Store -======= term1/fbs/fbs/lib/python3.9/site-packages/ term1/fbs/app/__pycache__/ *.pyc ->>>>>>> 1ca25fc0a8b243cee04e1a2fae7db6cb4d383145 From 8abbe945f57e8f641e0046df4e29a2b335cc6d39 Mon Sep 17 00:00:00 2001 From: elenavarbanova <48411601+elenavarbanova@users.noreply.github.com> Date: Thu, 2 Dec 2021 10:00:40 +0200 Subject: [PATCH 4/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e13115..0d74df8 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ $ marp 01.md && open 01.html |6| Валентин Найденов| [valentinmnaydenov](https://github.com/valentinmnaydenov) | | | |7| Данаил Божков | [DBozhkovV](https://github.com/DBozhkovV) |🍬🍬🍬 | | |8| Даниел Паунов | [McAwesome123](https://github.com/McAwesome123) | | | -|9| Елена Върбанова | [elenavarbanova](https://github.com/elenavarbanova) | 🍬 | | +|9| Елена Върбанова | [elenavarbanova](https://github.com/elenavarbanova) | 🍬🍬 | | |10| Златина Лилова | [zlatililova](https://github.com/zlatililova) | | | |11| Иваело Кръстев | [Ivaelo](https://github.com/Ivaelo) | | | |12| Ивайло Димов | [IvailoDimov](https://github.com/IvailoDimov) | | | From 4c118512252abc92b4c55fbb89b49575542691f2 Mon Sep 17 00:00:00 2001 From: Elena Varbanova Date: Wed, 12 Jan 2022 23:44:33 +0200 Subject: [PATCH 5/8] Rename first homework and add task 2 and 3 from second homework --- .../09_Elena_Varbanova/01_check_circles.py | 29 +++++++++++++++++++ homeworks/09_Elena_Varbanova/replace.py | 25 ++++++++++++++++ homeworks/09_Elena_Varbanova/step_counter.py | 18 ++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 homeworks/09_Elena_Varbanova/01_check_circles.py create mode 100644 homeworks/09_Elena_Varbanova/replace.py create mode 100644 homeworks/09_Elena_Varbanova/step_counter.py diff --git a/homeworks/09_Elena_Varbanova/01_check_circles.py b/homeworks/09_Elena_Varbanova/01_check_circles.py new file mode 100644 index 0000000..a7e3b6b --- /dev/null +++ b/homeworks/09_Elena_Varbanova/01_check_circles.py @@ -0,0 +1,29 @@ +import math + +def checkCircles(c1_center, c1_radius, c2_center, c2_radius): + diameter = math.sqrt((c2_center[0] - c1_center[0])**2 + (c2_center[1] - c1_center[1])**2) + sum_raduises = c1_radius + c2_radius + if c1_center == c2_center and c1_radius == c2_radius: + return "Matching" + if diameter == sum_raduises: + return "Touching" + if diameter + c1_radius <= c2_radius: + return "Circle 2 contains circle 1" + if diameter + c2_radius <= c1_radius: + return "Circle 1 contains circle 2" + if sum_raduises < diameter: + return "Intersecting" + else: + return "No common" +#Example for matching circles +print(checkCircles((3,3), 5, (3,3), 5)) +#Example for touching circles +print(checkCircles((2,4), 2, (5,4), 1)) +#Example for circle 2 containing circle 1 +print(checkCircles((2,2), 5, (3,3), 7)) +#Example for circle 1 containing circle 2 +print(checkCircles((6,6), 8, (4,4), 4)) +#Example for intersecting circles +print(checkCircles((3,3), 5, (9,9), 3)) +#Example for no common circles +print(checkCircles((3,3), 5, (8,9), 3)) \ No newline at end of file diff --git a/homeworks/09_Elena_Varbanova/replace.py b/homeworks/09_Elena_Varbanova/replace.py new file mode 100644 index 0000000..07b9e72 --- /dev/null +++ b/homeworks/09_Elena_Varbanova/replace.py @@ -0,0 +1,25 @@ +def replace(list, finding, replacing): + counter = 0 + + for index in list: + + if type(index) != int and len(index) > 1: + new_list = list[counter] + replace(new_list, finding, replacing) + + if index == finding: + list[counter] = replacing + counter = counter + 1 + + return list + + +list = [ 'a', 1, [ ['a', 'b'], 1], ([1, 3, 'a'], 'b')] +res = replace(list, 'a', 'c') +print(res)#[ 'c', 1, [ ['c', 'b'], 1], ([1, 3, 'c'], 'b')] + +print("...........") + +list1 = [ 2, 1, [ ['a', 'b'], 'c'], ([1, 3, 2], 'b')] +res1 = replace(list1, 1, 'e') +print(res1)#[ 2, 'e', [ ['a', 'b'], 'c'], (['e', 3, 2], 'b')] diff --git a/homeworks/09_Elena_Varbanova/step_counter.py b/homeworks/09_Elena_Varbanova/step_counter.py new file mode 100644 index 0000000..4310251 --- /dev/null +++ b/homeworks/09_Elena_Varbanova/step_counter.py @@ -0,0 +1,18 @@ +def fibonacci(number): + if number <= 1: + return number + return fibonacci(number - 1) + fibonacci(number - 2) + + +def num_ways(num): + return fibonacci(num + 1) + + +stair1 = 2 +print("Number of ways:", num_ways(stair1)) + +stair2 = 3 +print("Number of ways:", num_ways(stair2)) + +stair3 = 4 +print("Number of ways:", num_ways(stair3)) From 2e08b396088d6abd7acf18ee4347a3f3183d4df2 Mon Sep 17 00:00:00 2001 From: elenavarbanova <48411601+elenavarbanova@users.noreply.github.com> Date: Wed, 12 Jan 2022 23:45:59 +0200 Subject: [PATCH 6/8] delete because it is a duplicate --- .../09_Elena_Varbanova:01_check_circles.py | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 homeworks/09_Elena_Varbanova/09_Elena_Varbanova:01_check_circles.py diff --git a/homeworks/09_Elena_Varbanova/09_Elena_Varbanova:01_check_circles.py b/homeworks/09_Elena_Varbanova/09_Elena_Varbanova:01_check_circles.py deleted file mode 100644 index a7e3b6b..0000000 --- a/homeworks/09_Elena_Varbanova/09_Elena_Varbanova:01_check_circles.py +++ /dev/null @@ -1,29 +0,0 @@ -import math - -def checkCircles(c1_center, c1_radius, c2_center, c2_radius): - diameter = math.sqrt((c2_center[0] - c1_center[0])**2 + (c2_center[1] - c1_center[1])**2) - sum_raduises = c1_radius + c2_radius - if c1_center == c2_center and c1_radius == c2_radius: - return "Matching" - if diameter == sum_raduises: - return "Touching" - if diameter + c1_radius <= c2_radius: - return "Circle 2 contains circle 1" - if diameter + c2_radius <= c1_radius: - return "Circle 1 contains circle 2" - if sum_raduises < diameter: - return "Intersecting" - else: - return "No common" -#Example for matching circles -print(checkCircles((3,3), 5, (3,3), 5)) -#Example for touching circles -print(checkCircles((2,4), 2, (5,4), 1)) -#Example for circle 2 containing circle 1 -print(checkCircles((2,2), 5, (3,3), 7)) -#Example for circle 1 containing circle 2 -print(checkCircles((6,6), 8, (4,4), 4)) -#Example for intersecting circles -print(checkCircles((3,3), 5, (9,9), 3)) -#Example for no common circles -print(checkCircles((3,3), 5, (8,9), 3)) \ No newline at end of file From 0af24b3e5dd1c0729e5522bae42a323d30c5c79e Mon Sep 17 00:00:00 2001 From: Elena Varbanova Date: Mon, 17 Jan 2022 15:50:01 +0200 Subject: [PATCH 7/8] Update task 3 --- homeworks/09_Elena_Varbanova/replace.py | 36 +++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/homeworks/09_Elena_Varbanova/replace.py b/homeworks/09_Elena_Varbanova/replace.py index 07b9e72..149c056 100644 --- a/homeworks/09_Elena_Varbanova/replace.py +++ b/homeworks/09_Elena_Varbanova/replace.py @@ -1,25 +1,39 @@ -def replace(list, finding, replacing): +def replace(listing, finding, replacing): counter = 0 - for index in list: + for index in listing: if type(index) != int and len(index) > 1: - new_list = list[counter] - replace(new_list, finding, replacing) + + if type(index) == tuple: + new_list = list(listing[counter]) + new_list = replace(new_list, finding, replacing) + listing[counter] = tuple(new_list) + + else: + new_list = listing[counter] + new_list = replace(new_list, finding, replacing) if index == finding: - list[counter] = replacing + listing[counter] = replacing + counter = counter + 1 - return list + return listing -list = [ 'a', 1, [ ['a', 'b'], 1], ([1, 3, 'a'], 'b')] -res = replace(list, 'a', 'c') +listing = [ 'a', 1, [ ['a', 'b'], 1], ([1, 3, 'a'], 'a')]#last 'a' in English +res = replace(listing, 'a', 'c') print(res)#[ 'c', 1, [ ['c', 'b'], 1], ([1, 3, 'c'], 'b')] print("...........") -list1 = [ 2, 1, [ ['a', 'b'], 'c'], ([1, 3, 2], 'b')] -res1 = replace(list1, 1, 'e') -print(res1)#[ 2, 'e', [ ['a', 'b'], 'c'], (['e', 3, 2], 'b')] +list1 = [ 'a', 1, [ ['a', 'b'], 1], ([1, 3, 'a'], 'а')]#last 'a' in Bulgarian +res1 = replace(list1, 'a', 'c') +print(res1)#[ 2, 'e', [ ['a', 'b'], 'c'], (['e', 3, 2], 'a')] + +print("...........") + +list2 = [ 2, 1, [ ['a', 'b'], 'c'], ([1, 3, 2], 1)] +res2 = replace(list2, 1, 'e') +print(res2)#[ 2, 'e', [ ['a', 'b'], 'c'], (['e', 3, 2], 'b')] From c18c0c65b0fdf0c82b9607831eb76a9eb5415621 Mon Sep 17 00:00:00 2001 From: Elena Varbanova Date: Mon, 17 Jan 2022 15:56:06 +0200 Subject: [PATCH 8/8] Update task 3 --- homeworks/09_Elena_Varbanova/replace.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeworks/09_Elena_Varbanova/replace.py b/homeworks/09_Elena_Varbanova/replace.py index 149c056..de4ff53 100644 --- a/homeworks/09_Elena_Varbanova/replace.py +++ b/homeworks/09_Elena_Varbanova/replace.py @@ -21,7 +21,6 @@ def replace(listing, finding, replacing): return listing - listing = [ 'a', 1, [ ['a', 'b'], 1], ([1, 3, 'a'], 'a')]#last 'a' in English res = replace(listing, 'a', 'c') print(res)#[ 'c', 1, [ ['c', 'b'], 1], ([1, 3, 'c'], 'b')]