From 67c0b094863fa5d0fca21e7620b98396ae955cb3 Mon Sep 17 00:00:00 2001 From: rosik Date: Sat, 2 Apr 2022 15:19:29 +0300 Subject: [PATCH 01/32] Work on lab 1 --- Lab 01 - First Program/lab_01.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lab 01 - First Program/lab_01.py b/Lab 01 - First Program/lab_01.py index e69de29bb..27a4437ec 100644 --- a/Lab 01 - First Program/lab_01.py +++ b/Lab 01 - First Program/lab_01.py @@ -0,0 +1 @@ +print ("helo") From 90d04b6fa49af67e758c17d59798c3c788a86cf4 Mon Sep 17 00:00:00 2001 From: rosik Date: Sat, 2 Apr 2022 18:06:19 +0300 Subject: [PATCH 02/32] Merged --- Lab 01 - First Program/1.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Lab 01 - First Program/1.py diff --git a/Lab 01 - First Program/1.py b/Lab 01 - First Program/1.py new file mode 100644 index 000000000..6eaca1ae3 --- /dev/null +++ b/Lab 01 - First Program/1.py @@ -0,0 +1 @@ +print ("first merge request") From f70c09ea2b6e6ecc0038498dd7060f850c06faa4 Mon Sep 17 00:00:00 2001 From: rosik Date: Sat, 2 Apr 2022 19:08:00 +0300 Subject: [PATCH 03/32] Merged --- Lab 01 - First Program/.1.py.swp | Bin 0 -> 12288 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Lab 01 - First Program/.1.py.swp diff --git a/Lab 01 - First Program/.1.py.swp b/Lab 01 - First Program/.1.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..c046f0b39205fa212d7988e8721b84e5b38cf115 GIT binary patch literal 12288 zcmeI&PfNov9LDkAyo;i5AXbohXxell)fXTN4!q2hm(;ZbDWvAbmIzq_$*g&{Wr2q1s}0tg_000IagfB*vj cOrVm|<+ED#y=msgnR407e9`=~H{PlI07f1z9smFU literal 0 HcmV?d00001 From 7f0f80c25756eef1c5ba2b3da054f86d77e79149 Mon Sep 17 00:00:00 2001 From: rosik Date: Tue, 5 Apr 2022 18:18:03 +0300 Subject: [PATCH 04/32] first test paint with arcade --- Scratch work/drawing_samples.py | 52 ++++++++++++++++++++++++++++++++ Lab 01 - First Program/1.py | 14 ++++++++- Lab 01 - First Program/lab_01.py | 51 ++++++++++++++++++++++++++++++- Testing/test.py | 1 + 4 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 Scratch work/drawing_samples.py diff --git a/ Scratch work/drawing_samples.py b/ Scratch work/drawing_samples.py new file mode 100644 index 000000000..82eb4027c --- /dev/null +++ b/ Scratch work/drawing_samples.py @@ -0,0 +1,52 @@ +# This is a single-line comment. +import arcade +# Задать константы для размеров экрана +SCREEN_WIDTH = 600 +SCREEN_HEIGHT = 600 + +# Открыть окно. Задать заголовок и размеры окна (ширина и высота) +arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing Example") + +# Задать белый цвет фона. +# Для просмотра списка названий цветов прочитайте: +# http://arcade.academy/arcade.color.html +# Цвета также можно задавать в (красный, зеленый, синий) и +# (красный, зеленый, синий, альфа) формате. +arcade.set_background_color(arcade.color.WHITE) + +# Начать процесс рендера. Это нужно сделать до команд рисования +arcade.start_render() + +# Нарисовать лицо +x = 300 +y = 300 +radius = 200 +arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW) + +# Нарисовать правый глаз +x = 370 +y = 350 +radius = 20 +arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK) + +# Нарисовать левый глаз +x = 230 +y = 350 +radius = 20 +arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK) + +# Нарисовать улыбку +x = 300 +y = 280 +width = 120 +height = 100 +start_angle = 190 +end_angle = 350 +arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle, + end_angle, 10) + +# Завершить рисование и показать результат +arcade.finish_render() + +# Держать окно открытым до тех пор, пока пользователь не нажмет кнопку “закрыть” +arcade.run() \ No newline at end of file diff --git a/Lab 01 - First Program/1.py b/Lab 01 - First Program/1.py index 6eaca1ae3..bd4941a45 100644 --- a/Lab 01 - First Program/1.py +++ b/Lab 01 - First Program/1.py @@ -1 +1,13 @@ -print ("first merge request") +""" +This is a sample program to show how to draw using the Python programming +language and the Arcade library. +""" + +# Import the "arcade" library +import arcade + +# Open up a window. +# From the "arcade" library, use a function called "open_window" +# Set the dimensions (width and height) +# Set the window title to "Drawing Example" +arcade.open_window(600, 600, "Drawing Example") \ No newline at end of file diff --git a/Lab 01 - First Program/lab_01.py b/Lab 01 - First Program/lab_01.py index 27a4437ec..834f78449 100644 --- a/Lab 01 - First Program/lab_01.py +++ b/Lab 01 - First Program/lab_01.py @@ -1 +1,50 @@ -print ("helo") +# This is a single-line comment. +import arcade +# Задать константы для размеров экрана +SCREEN_WIDTH = 600 +SCREEN_HEIGHT = 600 + +# Открыть окно. Задать заголовок и размеры окна (ширина и высота) +arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing Example") + +# Задать белый цвет фона. +# Цвета также можно задавать в (красный, зеленый, синий) и +# (красный, зеленый, синий, альфа) формате. +arcade.set_background_color(arcade.color.WHITE) + +# Начать процесс рендера. Это нужно сделать до команд рисования +arcade.start_render() + +# Нарисовать лицо +x = 300 +y = 300 +radius = 200 +arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW) + +# Нарисовать правый глаз +x = 370 +y = 350 +radius = 20 +arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK) + +# Нарисовать левый глаз +x = 230 +y = 350 +radius = 20 +arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK) + +# Нарисовать улыбку +x = 300 +y = 280 +width = 120 +height = 100 +start_angle = 190 +end_angle = 350 +arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle, + end_angle, 10) + +# Завершить рисование и показать результат +arcade.finish_render() + +# Держать окно открытым до тех пор, пока пользователь не нажмет кнопку “закрыть” +arcade.run() \ No newline at end of file diff --git a/Testing/test.py b/Testing/test.py index e69de29bb..6e441f7ec 100644 --- a/Testing/test.py +++ b/Testing/test.py @@ -0,0 +1 @@ +print ("Hello World!") \ No newline at end of file From 1dc033b1ace7a1c6049acb78a41992d2dfa5b370 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Mon, 7 Nov 2022 17:11:11 +0200 Subject: [PATCH 05/32] test --- Lab 02 - Draw a Picture/lab_02.py | 86 +++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/Lab 02 - Draw a Picture/lab_02.py b/Lab 02 - Draw a Picture/lab_02.py index e69de29bb..b65714849 100644 --- a/Lab 02 - Draw a Picture/lab_02.py +++ b/Lab 02 - Draw a Picture/lab_02.py @@ -0,0 +1,86 @@ +""" +This is a sample program to show how to draw using the Python programming +language and the Arcade library. +""" + +# Import the "arcade" library +import arcade + +# Open up a window. +# From the "arcade" library, use a function called "open_window" +# Set the window title to "Drawing Example" +# Set the and dimensions (width and height) +arcade.open_window(800, 600, "Drawing Example") + +# Set the background color +arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE) + +# Get ready to draw +arcade.start_render() + +# Draw the grass +arcade.draw_lrtb_rectangle_filled(0, 800, 200, 0, arcade.color.BITTER_LIME) + +# Barn cement base +arcade.draw_lrtb_rectangle_filled(30, 350, 210, 170, arcade.color.BISQUE) + +# draw the wall +arcade.draw_lrtb_rectangle_filled(30, 350, 400, 190, arcade.color.BROWN) + + +arcade.draw_polygon_filled([[10, 400], + [75, 540], + [300, 540], + [380, 400]], + arcade.color.BROWN) +'''# Draw the top +arcade.draw_triangle_filled(15, 400, 65, 400, 65, 500, arcade.color.BROWN) +arcade.draw_triangle_filled(300, 400, 365, 400, 300, 500, arcade.color.BROWN) +arcade.draw_lrtb_rectangle_filled(65, 300, 500, 400, arcade.color.LAVA) + +arcade.draw_triangle_filled(65, 500, 300, 500, 180, 550, arcade.color.BROWN) +''' +#window top +arcade.draw_lrtb_rectangle_filled(65, 125, 480, 415, arcade.color.BLACK) +arcade.draw_lrtb_rectangle_filled(230, 300, 480, 420, arcade.color.BLACK) +arcade.draw_lrtb_rectangle_filled(70, 120, 475, 420, arcade.color.WHITE) +arcade.draw_lrtb_rectangle_filled(235, 295, 475, 425, arcade.color.WHITE) + +#window left +arcade.draw_lrtb_rectangle_filled(65, 125, 300, 250, arcade.color.BLACK ) +arcade.draw_lrtb_rectangle_filled(70, 120, 295, 255, arcade.color.WHITE ) + +#window right +arcade.draw_lrtb_rectangle_filled(230, 300, 300, 250, arcade.color.BLACK ) +arcade.draw_lrtb_rectangle_filled(235, 295, 295, 255, arcade.color.WHITE ) + +#door +arcade.draw_lrtb_rectangle_filled(150, 200, 300, 190, arcade.color.ASH_GREY ) + + +#machine body +arcade.draw_lrtb_rectangle_filled(480, 690, 210, 120, arcade.color.ASH_GREY ) +arcade.draw_lrtb_rectangle_filled(510, 650, 150, 120, arcade.color.BLACK ) +arcade.draw_lrtb_rectangle_filled(600, 610, 250, 210, arcade.color.BLACK ) + +#back wheel +arcade.draw_circle_filled(450, 150, 55, arcade.color.BLACK) +arcade.draw_circle_filled(450, 150, 50, arcade.color.PAYNE_GREY) +arcade.draw_circle_filled(450, 150, 35, arcade.color.WHITE) +arcade.draw_circle_filled(450, 150, 15, arcade.color.RED) + +#front wheel +arcade.draw_circle_filled(650, 130, 35, arcade.color.BLACK) +arcade.draw_circle_filled(650, 130, 30, arcade.color.PAYNE_GREY) +arcade.draw_circle_filled(650, 130, 25, arcade.color.WHITE) +arcade.draw_circle_filled(650, 130, 5, arcade.color.RED) + + + + + +# --- Finish drawing --- +arcade.finish_render() + +# Keep the window up until someone closes it. +arcade.run() \ No newline at end of file From 83a9330124bcf22b887df475ab1a531fd71d2e26 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Wed, 9 Nov 2022 12:40:59 +0200 Subject: [PATCH 06/32] test comit --- Lab 03 - Draw Using Functions/lab_03.py | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Lab 03 - Draw Using Functions/lab_03.py b/Lab 03 - Draw Using Functions/lab_03.py index e69de29bb..5d02341f8 100644 --- a/Lab 03 - Draw Using Functions/lab_03.py +++ b/Lab 03 - Draw Using Functions/lab_03.py @@ -0,0 +1,33 @@ +# Import the "arcade" library +import arcade + +# Open up a window. +# From the "arcade" library, use a function called "open_window" +# Set the window title to "Drawing Example" +# Set the and dimensions (width and height) +arcade.open_window(800, 600, "Drawing Example") + +# Set the background color +arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE) + +# Get ready to draw +arcade.start_render() + + +arcade.draw_ellipse_outline(450, 50, 470, 700, arcade.csscolor.DIM_GREY, 3) +arcade.draw_ellipse_filled(450, 50, 465, 695, arcade.csscolor.DARK_GREEN) +arcade.draw_ellipse_outline(800, 300, 700, 400, arcade.csscolor.DIM_GREY, 3) +arcade.draw_ellipse_filled(800, 300, 695, 395, arcade.csscolor.DARK_GREEN) +arcade.draw_ellipse_outline(250, 200, 600, 270, arcade.csscolor.DIM_GREY, 3) +arcade.draw_ellipse_filled(250, 200, 595, 265, arcade.csscolor.DARK_GREEN) +arcade.draw_ellipse_outline(1, 250, 700, 400, arcade.csscolor.DIM_GREY, 3) +arcade.draw_ellipse_filled(1, 250, 695, 395, arcade.csscolor.DARK_GREEN) + +arcade.draw_lrtb_rectangle_filled(0, 800, 180, 0, arcade.color.MINT_GREEN) + + +# --- Finish drawing --- +arcade.finish_render() + +# Keep the window up until someone closes it. +arcade.run() \ No newline at end of file From 0de227c0e7212aa1630c3028d1bc1377c420971d Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Wed, 9 Nov 2022 12:42:32 +0200 Subject: [PATCH 07/32] 123 --- Lab 03 - Draw Using Functions/Snow_03.py | 51 ++++++++++++++++++++++++ Lab 03 - Draw Using Functions/lab_03.py | 10 ++++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 Lab 03 - Draw Using Functions/Snow_03.py diff --git a/Lab 03 - Draw Using Functions/Snow_03.py b/Lab 03 - Draw Using Functions/Snow_03.py new file mode 100644 index 000000000..f3f806dc1 --- /dev/null +++ b/Lab 03 - Draw Using Functions/Snow_03.py @@ -0,0 +1,51 @@ +import arcade + +SCREEN_WIDTH = 800 +SCREEN_HEIGHT = 600 + +def draw_grass(): + """ Draw the ground """ + arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3, 0, arcade.color.GREEN) + +def draw_snow_person(x, y): + """ Draw a snow person """ + + # Draw a point at x, y for reference + arcade.draw_point(x, y, arcade.color.RED, 5) + + # Snow + arcade.draw_circle_filled(300 + x, 200 + y, 60, arcade.color.WHITE) + arcade.draw_circle_filled(300 + x, 280 + y, 50, arcade.color.WHITE) + arcade.draw_circle_filled(300 + x, 340 + y, 40, arcade.color.WHITE) + + # Eyes + arcade.draw_circle_filled(285 + x, 350 + y, 5, arcade.color.BLACK) + arcade.draw_circle_filled(315 + x, 350 + y, 5, arcade.color.BLACK) + +def on_draw(delta_time): + """ Draw everything """ + arcade.start_render() + + draw_grass() + draw_snow_person(on_draw.snow_person1_x, 140) + draw_snow_person(450, 180) +on_draw.snow_person1_x = 150 + +def main(): + arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing with Functions") + arcade.set_background_color(arcade.color.DARK_BLUE) + arcade.start_render() + + arcade.schedule(on_draw, 1/60) + arcade.run() + + # Finish and run + arcade.finish_render() + arcade.run() + + + + + + +main() \ No newline at end of file diff --git a/Lab 03 - Draw Using Functions/lab_03.py b/Lab 03 - Draw Using Functions/lab_03.py index 5d02341f8..36096e06a 100644 --- a/Lab 03 - Draw Using Functions/lab_03.py +++ b/Lab 03 - Draw Using Functions/lab_03.py @@ -25,7 +25,15 @@ arcade.draw_lrtb_rectangle_filled(0, 800, 180, 0, arcade.color.MINT_GREEN) - +arcade.draw_arc_outline(300, + 340, + 70, + 50, + arcade.csscolor.BLACK, + 20, + 180, + 3, + 0) # --- Finish drawing --- arcade.finish_render() From 5642a7443a556809e4eb65a2ead342c286e17fb3 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Wed, 9 Nov 2022 14:14:11 +0200 Subject: [PATCH 08/32] q --- Lab 10 - Spell Check/lab_10.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lab 10 - Spell Check/lab_10.py b/Lab 10 - Spell Check/lab_10.py index e69de29bb..d914e93ac 100644 --- a/Lab 10 - Spell Check/lab_10.py +++ b/Lab 10 - Spell Check/lab_10.py @@ -0,0 +1,5 @@ +done = False +while not done: + quit = input("Do you want to quit? ") + if quit == "y": + done = True \ No newline at end of file From 3ff4157a2c37426b0a022065e9fa28453c00af09 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Thu, 10 Nov 2022 16:57:17 +0200 Subject: [PATCH 09/32] test --- Lab 04 - Camel/mudball.py | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Lab 04 - Camel/mudball.py diff --git a/Lab 04 - Camel/mudball.py b/Lab 04 - Camel/mudball.py new file mode 100644 index 000000000..4a93ff59d --- /dev/null +++ b/Lab 04 - Camel/mudball.py @@ -0,0 +1,40 @@ +import math + +def get_player_names(): + """ Get a list of names from the players. """ + print("Enter player names. Enter as many players as you like.") + done = False + players = [] + while not done: + player = input("Enter player (hit enter to quit): ") + if len(player) > 0: + players.append(player) + else: + done = True + + print() + return players + +def get_user_input(): + """ Get the user input for psi and angle. Return as a list of two + numbers. """ + # Later on in the 'exceptions' chapter, we will learn how to modify + # this code to not crash the game if the user types in something that + # isn't a valid number. + psi = float(input( " charge the gun with how many psi? ")) + angle = float(input( " move the gun at what angle? ")) + return psi, angle + +def calculate_distance(psi, angle_in_degrees): + """ Calculate the distance the mudball flies. """ + angle_in_radians = math.radians(angle_in_degrees) + distance = .5 * psi ** 2 * math.sin(angle_in_radians) * math.cos(angle_in_radians) + return distance + print (distance) + +def main(): + get_user_input() + calculate_distance() + +main() + From 52a8bc249c8a084a781c780f72b8fd4fc3514c70 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Fri, 11 Nov 2022 17:36:21 +0200 Subject: [PATCH 10/32] lab04 --- Lab 04 - Camel/1-9_romb.py | 20 ++++++++++++++++++++ Lab 10 - Spell Check/lab_10.py | 8 +++----- 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 Lab 04 - Camel/1-9_romb.py diff --git a/Lab 04 - Camel/1-9_romb.py b/Lab 04 - Camel/1-9_romb.py new file mode 100644 index 000000000..6f78fdb3a --- /dev/null +++ b/Lab 04 - Camel/1-9_romb.py @@ -0,0 +1,20 @@ +for row in range(10): + + for space in range( 10 - row ): + print(" ", end=" ") + for column in range(1, row + 1): + print(column, end=" ") + for column in range( row - 1, 0, -1 ): + print(column, end=" ") + print() +for row in range (10): + + for space2 in range(row + 2): + print(" ", end=" ") + for column in range(1, 9 - row ): + print(column, end=" ") + for column in range(7 - row, 0, -1): + print(column, end=" ") + + + print() diff --git a/Lab 10 - Spell Check/lab_10.py b/Lab 10 - Spell Check/lab_10.py index d914e93ac..54cffbf00 100644 --- a/Lab 10 - Spell Check/lab_10.py +++ b/Lab 10 - Spell Check/lab_10.py @@ -1,5 +1,3 @@ -done = False -while not done: - quit = input("Do you want to quit? ") - if quit == "y": - done = True \ No newline at end of file +import random +numb = random.random() * 5 + 5 +print(numb) From 861910aa2c1b9ce7f9a90d2ac15f681c58ed993c Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Fri, 11 Nov 2022 17:54:00 +0200 Subject: [PATCH 11/32] 345 --- Lab 10 - Spell Check/lab_10.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/Lab 10 - Spell Check/lab_10.py b/Lab 10 - Spell Check/lab_10.py index 54cffbf00..e69de29bb 100644 --- a/Lab 10 - Spell Check/lab_10.py +++ b/Lab 10 - Spell Check/lab_10.py @@ -1,3 +0,0 @@ -import random -numb = random.random() * 5 + 5 -print(numb) From 30e94325a13ffc91c22e8df6ce2aa7d49e2a8bd5 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Tue, 15 Nov 2022 13:47:29 +0200 Subject: [PATCH 12/32] 111111 --- Lab 04 - Camel/1-9_romb.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Lab 04 - Camel/1-9_romb.py b/Lab 04 - Camel/1-9_romb.py index 6f78fdb3a..530735d17 100644 --- a/Lab 04 - Camel/1-9_romb.py +++ b/Lab 04 - Camel/1-9_romb.py @@ -7,14 +7,14 @@ for column in range( row - 1, 0, -1 ): print(column, end=" ") print() -for row in range (10): +for row2 in range (10): - for space2 in range(row + 2): + for space2 in range(row2 + 2): print(" ", end=" ") - for column in range(1, 9 - row ): - print(column, end=" ") - for column in range(7 - row, 0, -1): - print(column, end=" ") + for column2 in range(1, 9 - row2 ): + print(column2, end=" ") + for column2 in range(7 - row2, 0, -1): + print(column2, end=" ") print() From a9ea721f1551aed5eff31d8a1e045cc391d4fb44 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Tue, 15 Nov 2022 15:28:59 +0200 Subject: [PATCH 13/32] 2345 --- Lab 04 - Camel/12month.py | 11 +++++++++++ Lab 04 - Camel/12month_2.py | 5 +++++ ...0\276\321\202_\321\207\320\265\320\272\320\260.py" | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 Lab 04 - Camel/12month.py create mode 100644 Lab 04 - Camel/12month_2.py create mode 100644 "Lab 04 - Camel/\320\277\321\200\320\276\321\206\320\265\320\275\321\202_\320\276\321\202_\321\207\320\265\320\272\320\260.py" diff --git a/Lab 04 - Camel/12month.py b/Lab 04 - Camel/12month.py new file mode 100644 index 000000000..c8f7062e1 --- /dev/null +++ b/Lab 04 - Camel/12month.py @@ -0,0 +1,11 @@ +months = "JanFebMarAprMayJunJulAugSepOctNovDec" +n = int(input("Enter a month number: ")) +k = 1 +s = 0 +e = 3 +while k != n: + k += 1 + s += 3 + e += 3 + +print(months[s:e]) \ No newline at end of file diff --git a/Lab 04 - Camel/12month_2.py b/Lab 04 - Camel/12month_2.py new file mode 100644 index 000000000..e41d5934e --- /dev/null +++ b/Lab 04 - Camel/12month_2.py @@ -0,0 +1,5 @@ +months = "JanFebMarAprMayJunJulAugSepOctNovDec" +n = int(input("Enter a month number: ")) +selected_month = [months[i:i+3] for i in range(0, len(months), 3)][n-1] +print('selected month is: ', selected_month) +5 \ No newline at end of file diff --git "a/Lab 04 - Camel/\320\277\321\200\320\276\321\206\320\265\320\275\321\202_\320\276\321\202_\321\207\320\265\320\272\320\260.py" "b/Lab 04 - Camel/\320\277\321\200\320\276\321\206\320\265\320\275\321\202_\320\276\321\202_\321\207\320\265\320\272\320\260.py" new file mode 100644 index 000000000..413f520d4 --- /dev/null +++ "b/Lab 04 - Camel/\320\277\321\200\320\276\321\206\320\265\320\275\321\202_\320\276\321\202_\321\207\320\265\320\272\320\260.py" @@ -0,0 +1,5 @@ +print("щедрый посетитель") +print("Счет") +check = int(input("Введите суму счета - ")) +print("20% от чека = ", check/100*20) +print("15% от чека = ", check/100*15) \ No newline at end of file From d14d731fd25e2245a8ad6689e5fe9dfe837d3236 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Tue, 15 Nov 2022 17:18:29 +0200 Subject: [PATCH 14/32] dgbdb --- Lab 05 - Loopy Lab/Class_test.py | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Lab 05 - Loopy Lab/Class_test.py diff --git a/Lab 05 - Loopy Lab/Class_test.py b/Lab 05 - Loopy Lab/Class_test.py new file mode 100644 index 000000000..1534703ee --- /dev/null +++ b/Lab 05 - Loopy Lab/Class_test.py @@ -0,0 +1,43 @@ +class Address: + + def __init__(self): + self.name = "" + self.line1 = "" + self.line2 = "" + self.city = "" + self.state = "" + self.zip = "" + + +def main(): + # Create an address + home_address = Address() + + # Set the fields in the address + home_address.name = "John Smith" + home_address.line1 = "701 N. C Street" + home_address.line2 = "Carver Science Building" + home_address.city = "Indianola" + home_address.state = "IA" + home_address.zip = "50125" + + # Create another address + vacation_home_address = Address() + + # Set the fields in the address + vacation_home_address.name = "John Smith" + vacation_home_address.line1 = "1122 Main Street" + vacation_home_address.line2 = "" + vacation_home_address.city = "Panama City Beach" + vacation_home_address.state = "FL" + vacation_home_address.zip = "32407" + + print("The client's main home is in " + home_address.city) + print("His vacation home is in " + vacation_home_address.city) + + +main() + + + + From dce8d59d0983e1935b991ef82a28988b285762b0 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Wed, 16 Nov 2022 17:49:24 +0200 Subject: [PATCH 15/32] 569 --- Scratch work/1.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Scratch work/1.py diff --git a/ Scratch work/1.py b/ Scratch work/1.py new file mode 100644 index 000000000..960591fcc --- /dev/null +++ b/ Scratch work/1.py @@ -0,0 +1,13 @@ +print("Автодилер") +price=int(input("\nВведите стоимость автомобиля без наценок: ")) + +nalog=price/100*10 +sbor_reg=price/100*5 +sbor_ag=price+1500 +delivery=price+1000 +everything=nalog+sbor_reg+sbor_ag+delivery +print(""" 'Итого: налог', nalog, + '\nрегистрацьіонньій сбор' sbor_reg, + '\nагенский сбор', sbor_ag, + '\nдоставка', delivery + '\nВсього:' everything """) \ No newline at end of file From 8cd303eeb492eb344244d70afce2e1e08e02856e Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Thu, 17 Nov 2022 12:49:32 +0200 Subject: [PATCH 16/32] 11111111122222222 --- Scratch work/1.py | 16 ++++------------ Lab 04 - Camel/lab_04.py | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ Scratch work/1.py b/ Scratch work/1.py index 960591fcc..610af7067 100644 --- a/ Scratch work/1.py +++ b/ Scratch work/1.py @@ -1,13 +1,5 @@ -print("Автодилер") -price=int(input("\nВведите стоимость автомобиля без наценок: ")) +long = float(input("введите длину комнаты ")) +wide = float(input("введите ширину комнаты ")) +s = long * wide +print(round(s, 2), "см2") -nalog=price/100*10 -sbor_reg=price/100*5 -sbor_ag=price+1500 -delivery=price+1000 -everything=nalog+sbor_reg+sbor_ag+delivery -print(""" 'Итого: налог', nalog, - '\nрегистрацьіонньій сбор' sbor_reg, - '\nагенский сбор', sbor_ag, - '\nдоставка', delivery - '\nВсього:' everything """) \ No newline at end of file diff --git a/Lab 04 - Camel/lab_04.py b/Lab 04 - Camel/lab_04.py index e69de29bb..e7bceaec2 100644 --- a/Lab 04 - Camel/lab_04.py +++ b/Lab 04 - Camel/lab_04.py @@ -0,0 +1,22 @@ +def main(): + print(""" Welcome to Camel! + You have stolen a camel to make your way across the great Mobi desert. + The natives want their camel back and are chasing you down! Survive your + desert trek and out run the natives. + """) + done = False + choise = (input("What is your choice? ")) + if choise.upper == Q: + done = True + + while done is False: + print(""" + A. Drink from your canteen. + B. Ahead moderate speed. + C. Ahead full speed. + D. Stop for the night. + E. Status check. + Q. Quit. + """) + +main() \ No newline at end of file From b3fb8bc770f1befabc272014a092a54da361bc1e Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Thu, 17 Nov 2022 12:50:39 +0200 Subject: [PATCH 17/32] 1234321 --- Lab 04 - Camel/lab_04.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Lab 04 - Camel/lab_04.py b/Lab 04 - Camel/lab_04.py index e7bceaec2..5c212fb78 100644 --- a/Lab 04 - Camel/lab_04.py +++ b/Lab 04 - Camel/lab_04.py @@ -6,17 +6,6 @@ def main(): """) done = False choise = (input("What is your choice? ")) - if choise.upper == Q: - done = True - - while done is False: - print(""" - A. Drink from your canteen. - B. Ahead moderate speed. - C. Ahead full speed. - D. Stop for the night. - E. Status check. - Q. Quit. - """) + main() \ No newline at end of file From de81ccfb5c405b241fdec8d1184428882d314762 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Thu, 17 Nov 2022 15:31:00 +0200 Subject: [PATCH 18/32] 11 --- Lab 04 - Camel/lab_04.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Lab 04 - Camel/lab_04.py b/Lab 04 - Camel/lab_04.py index 5c212fb78..ca5a344af 100644 --- a/Lab 04 - Camel/lab_04.py +++ b/Lab 04 - Camel/lab_04.py @@ -5,7 +5,33 @@ def main(): desert trek and out run the natives. """) done = False - choise = (input("What is your choice? ")) + way_miles = 0 + camael_tired = 0 + water_balbance = 0 + water_botles = 3 + tusems_way = -20 + + while not done: + + choise = (input(""" + A. Drink from your canteen. + B. Ahead moderate speed. + C. Ahead full speed. + D. Stop for the night. + E. Status check. + Q. Quit. + + What is your choice? """)) + if choise.upper() == "Q": + done = True + print("you quit") + elif choise.upper() == "E": + print("Miles traveled:", way_miles) + print("Drinks in canteen:", water_botles) + print("The natives are " + str(way_miles - tusems_way) + " miles behind you.") + + + main() \ No newline at end of file From 16f26bc5d3d30049c1d81ab5380271903abc7bb8 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Thu, 17 Nov 2022 16:50:44 +0200 Subject: [PATCH 19/32] 456321789 --- Lab 04 - Camel/lab_04.py | 79 +++++++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 14 deletions(-) diff --git a/Lab 04 - Camel/lab_04.py b/Lab 04 - Camel/lab_04.py index ca5a344af..6d5a7e040 100644 --- a/Lab 04 - Camel/lab_04.py +++ b/Lab 04 - Camel/lab_04.py @@ -1,3 +1,4 @@ +import random def main(): print(""" Welcome to Camel! You have stolen a camel to make your way across the great Mobi desert. @@ -7,29 +8,79 @@ def main(): done = False way_miles = 0 camael_tired = 0 - water_balbance = 0 - water_botles = 3 + water_balance = 0 + water_botles = 4 tusems_way = -20 while not done: choise = (input(""" - A. Drink from your canteen. - B. Ahead moderate speed. - C. Ahead full speed. - D. Stop for the night. - E. Status check. - Q. Quit. + A. Выпить воды с запасов. + B. Двигаться вперед. + C. Двигаться вперед на полной скорости. + D. Остановиться на ночь. + E. Проверить статус. + Q. Выйти. - What is your choice? """)) + Сделайте свой выбор? """)) if choise.upper() == "Q": done = True - print("you quit") + print("Вы вышли") elif choise.upper() == "E": - print("Miles traveled:", way_miles) - print("Drinks in canteen:", water_botles) - print("The natives are " + str(way_miles - tusems_way) + " miles behind you.") - + print("Пройдено миль:", way_miles) + print("Бутылок в запасах:", water_botles) + print("Туземцы на " + str(way_miles - tusems_way) + " миль позади тебя.") + elif choise.upper() == "D": + print("Верблюд отдохнул, усталость сброшена") + camael_tired = 0 + tusems_way =+ random.randrange(7, 15) + elif choise.upper() == "C": + water_balance += 1 + way_miles += random.randrange(10, 21) + camael_tired += random.randrange(1, 4) + tusems_way += random.randrange(7, 15) + print("Вы прошли - " + str(way_miles) + " миль") + elif choise.upper() == "B": + water_balance += 1 + way_miles += random.randrange(5, 13) + camael_tired += 1 + tusems_way += random.randrange(7, 15) + print("Вы прошли - " + str(way_miles) + " миль") + elif choise.upper() == "A": + if water_botles > 0: + water_balance = 0 + water_botles -= 1 + else: + print("Вода закончилась") + while water_balance in range(4, 7): + print("Вы хотите пить") + break + while water_balance > 6: + print("Вы умерли от жажды") + done = True + break + while camael_tired in range(5, 9): + print("Ваш верблюд устал, необходимо остановиться на ночь для отдыха") + break + while camael_tired > 8: + print("Ваш верблюд умер, вы проиграли") + done = True + break + while tusems_way == way_miles: + print("Туземцы вас поймали, вы проиграли") + done = True + break + while way_miles - tusems_way < 15: + print("Туземцы приближаются!") + break + while way_miles > 200: + print("Вы прошли пустыню, и выиграли") + done = True + break + + + + From 0640db6017ec85867c6f27473ae0bc9b8ae641ed Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Thu, 17 Nov 2022 17:29:36 +0200 Subject: [PATCH 20/32] 123 --- Lab 05 - Loopy Lab/lab_05.py | 86 ++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index e69de29bb..ca24b1491 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -0,0 +1,86 @@ +import arcade + + +def draw_section_outlines(): + # Draw squares on bottom + arcade.draw_rectangle_outline(150, 150, 300, 300, arcade.color.BLACK) + arcade.draw_rectangle_outline(450, 150, 300, 300, arcade.color.BLACK) + arcade.draw_rectangle_outline(750, 150, 300, 300, arcade.color.BLACK) + arcade.draw_rectangle_outline(1050, 150, 300, 300, arcade.color.BLACK) + + # Draw squares on top + arcade.draw_rectangle_outline(150, 450, 300, 300, arcade.color.BLACK) + arcade.draw_rectangle_outline(450, 450, 300, 300, arcade.color.BLACK) + arcade.draw_rectangle_outline(750, 450, 300, 300, arcade.color.BLACK) + arcade.draw_rectangle_outline(1050, 450, 300, 300, arcade.color.BLACK) + +def draw_section_1(): + for row in range(30): + for column in range(30): + x = 0 # Instead of zero, calculate the proper x location using 'column' + y = 0 # Instead of zero, calculate the proper y location using 'row' + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + +def draw_section_2(): + # Below, replace "pass" with your code for the loop. + # Use the modulus operator and an if statement to select the color + # Don't loop from 30 to 60 to shift everything over, just add 300 to x. + pass + + +def draw_section_3(): + # Use the modulus operator and an if/else statement to select the color. + # Don't use multiple 'if' statements. + pass + + +def draw_section_4(): + # Use the modulus operator and just one 'if' statement to select the color. + pass + + +def draw_section_5(): + # Do NOT use 'if' statements to complete 5-8. Manipulate the loops instead. + pass + + +def draw_section_6(): + pass + + +def draw_section_7(): + pass + + +def draw_section_8(): + pass + + + + +def main(): + # Create a window + arcade.open_window(1200, 600, "Lab 05 - Loopy Lab") + arcade.set_background_color(arcade.color.AIR_FORCE_BLUE) + + arcade.start_render() + + # Draw the outlines for the sections + draw_section_outlines() + + # Draw the sections + draw_section_1() + draw_section_2() + draw_section_3() + draw_section_4() + draw_section_5() + draw_section_6() + draw_section_7() + draw_section_8() + + arcade.finish_render() + + arcade.run() + + +main() \ No newline at end of file From 55ef68ac4bb207cba2a608a15c74a325bae38184 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Thu, 17 Nov 2022 17:48:32 +0200 Subject: [PATCH 21/32] 32 --- Scratch work/1.py | 10 ++++++---- Lab 05 - Loopy Lab/lab_05.py | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ Scratch work/1.py b/ Scratch work/1.py index 610af7067..d00c60b82 100644 --- a/ Scratch work/1.py +++ b/ Scratch work/1.py @@ -1,5 +1,7 @@ -long = float(input("введите длину комнаты ")) -wide = float(input("введите ширину комнаты ")) -s = long * wide -print(round(s, 2), "см2") +for row in range(10): + + for column in range(1, row + 1): + print(column, end=" ") + + print() \ No newline at end of file diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index ca24b1491..d8e351560 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -3,7 +3,7 @@ def draw_section_outlines(): # Draw squares on bottom - arcade.draw_rectangle_outline(150, 150, 300, 300, arcade.color.BLACK) + arcade.draw_rectangle_outline(150, 150, 300, 300, arcade.color.GRAY) arcade.draw_rectangle_outline(450, 150, 300, 300, arcade.color.BLACK) arcade.draw_rectangle_outline(750, 150, 300, 300, arcade.color.BLACK) arcade.draw_rectangle_outline(1050, 150, 300, 300, arcade.color.BLACK) @@ -15,11 +15,13 @@ def draw_section_outlines(): arcade.draw_rectangle_outline(1050, 450, 300, 300, arcade.color.BLACK) def draw_section_1(): - for row in range(30): + for row in range(30): for column in range(30): - x = 0 # Instead of zero, calculate the proper x location using 'column' - y = 0 # Instead of zero, calculate the proper y location using 'row' + x = 5 # Instead of zero, calculate the proper x location using 'column' + y = 5 # Instead of zero, calculate the proper y location using 'row' + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + def draw_section_2(): # Below, replace "pass" with your code for the loop. From c48b88a8e65c8c7de9e09420e1eea99f8ccb6ec9 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Fri, 18 Nov 2022 13:55:05 +0200 Subject: [PATCH 22/32] 123 --- Lab 05 - Loopy Lab/lab_05.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index d8e351560..06acedad8 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -3,7 +3,7 @@ def draw_section_outlines(): # Draw squares on bottom - arcade.draw_rectangle_outline(150, 150, 300, 300, arcade.color.GRAY) + arcade.draw_rectangle_outline(150, 150, 300, 300, arcade.color.RED) arcade.draw_rectangle_outline(450, 150, 300, 300, arcade.color.BLACK) arcade.draw_rectangle_outline(750, 150, 300, 300, arcade.color.BLACK) arcade.draw_rectangle_outline(1050, 150, 300, 300, arcade.color.BLACK) @@ -17,8 +17,8 @@ def draw_section_outlines(): def draw_section_1(): for row in range(30): for column in range(30): - x = 5 # Instead of zero, calculate the proper x location using 'column' - y = 5 # Instead of zero, calculate the proper y location using 'row' + x = 30 # Instead of zero, calculate the proper x location using 'column' + y = 30 # Instead of zero, calculate the proper y location using 'row' arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) From 858a102dafa7a69c0ecf9b085b9a64583ee2bfd8 Mon Sep 17 00:00:00 2001 From: RosikOsadchy Date: Wed, 23 Nov 2022 17:40:40 +0200 Subject: [PATCH 23/32] 22 --- Lab 05 - Loopy Lab/lab_05.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index 06acedad8..3dcd6ed6e 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -15,12 +15,17 @@ def draw_section_outlines(): arcade.draw_rectangle_outline(1050, 450, 300, 300, arcade.color.BLACK) def draw_section_1(): - for row in range(30): + + for row in range(30): + for column in range(30): - x = 30 # Instead of zero, calculate the proper x location using 'column' - y = 30 # Instead of zero, calculate the proper y location using 'row' - + x = 5 # Instead of zero, calculate the proper x location using 'column' + y = 5 # Instead of zero, calculate the proper y location using 'row' arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + + + + def draw_section_2(): From e9039f654d6ae07e6c8ad92391dbca961bfd91a9 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Tue, 6 Dec 2022 15:30:47 +0200 Subject: [PATCH 24/32] 515151 --- Lab 05 - Loopy Lab/lab_05.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index 3dcd6ed6e..49f9ddf7c 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -19,8 +19,10 @@ def draw_section_1(): for row in range(30): for column in range(30): - x = 5 # Instead of zero, calculate the proper x location using 'column' - y = 5 # Instead of zero, calculate the proper y location using 'row' + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = column * 10 +5 + y = row * 10 + 5 arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) From 70b8b93c6013d7ed1c83e5f53bef20868cd65927 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Wed, 7 Dec 2022 12:58:13 +0200 Subject: [PATCH 25/32] lab_05 --- Lab 05 - Loopy Lab/lab_05.py | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index 49f9ddf7c..71fd7b075 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -31,6 +31,18 @@ def draw_section_1(): def draw_section_2(): + + for row in range(30): + + for column in range(30): + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = 300 + column * 10 +5 + y = row * 10 + 5 + if column % 2 == 0: + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + else: + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.BLACK) # Below, replace "pass" with your code for the loop. # Use the modulus operator and an if statement to select the color # Don't loop from 30 to 60 to shift everything over, just add 300 to x. @@ -38,17 +50,47 @@ def draw_section_2(): def draw_section_3(): + for row in range(30): + + for column in range(30): + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = 600 + column * 10 +5 + y = row * 10 + 5 + if row % 2 == 0: + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + else: + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.BLACK) # Use the modulus operator and an if/else statement to select the color. # Don't use multiple 'if' statements. pass def draw_section_4(): + for row in range(30): + + for column in range(30): + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = 900 + column * 10 +5 + y = row * 10 + 5 + if row % 2 == 0 and column %2 ==0: + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + else: + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.BLACK) # Use the modulus operator and just one 'if' statement to select the color. pass def draw_section_5(): + for row in range(30): + + for column in range(30): + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = column * 10 + 5 + y = n + row * 10 + 5 + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) # Do NOT use 'if' statements to complete 5-8. Manipulate the loops instead. pass From 54f578dbd833ac79a77a0a713c9ea06212a85536 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Wed, 7 Dec 2022 13:38:54 +0200 Subject: [PATCH 26/32] section_8 --- Lab 05 - Loopy Lab/lab_05.py | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index 71fd7b075..04dc72463 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -83,27 +83,56 @@ def draw_section_4(): def draw_section_5(): - for row in range(30): + for column in range(30): - for column in range(30): + for row in range(column + 1): x = 300 # Instead of zero, calculate the proper x location using 'column' y = 300 # Instead of zero, calculate the proper y location using 'row' x = column * 10 + 5 - y = n + row * 10 + 5 + y = 300 + row * 10 + 5 + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) # Do NOT use 'if' statements to complete 5-8. Manipulate the loops instead. pass def draw_section_6(): + for row in range(30): + + for column in range(30 - row): + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = 300 + column * 10 + 5 + y = 300 + row * 10 + 5 + + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + pass def draw_section_7(): + for row in range(30): + + for column in range(row + 1): + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = 600 + column * 10 + 5 + y = 300 + row * 10 + 5 + + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) pass def draw_section_8(): + for row in range(30): + + for column in range(row - 30): + x = 300 # Instead of zero, calculate the proper x location using 'column' + y = 300 # Instead of zero, calculate the proper y location using 'row' + x = 900 + column * 10 + 5 + y = 300 + row * 10 + 5 + + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) pass From acdb03ccc3fd0214f3eda3c7fac8e7f3d0312133 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Wed, 7 Dec 2022 15:20:55 +0200 Subject: [PATCH 27/32] section_8 --- Lab 05 - Loopy Lab/lab_05.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index 04dc72463..cda3c07ea 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -124,17 +124,11 @@ def draw_section_7(): def draw_section_8(): - for row in range(30): - - for column in range(row - 30): - x = 300 # Instead of zero, calculate the proper x location using 'column' - y = 300 # Instead of zero, calculate the proper y location using 'row' - x = 900 + column * 10 + 5 - y = 300 + row * 10 + 5 - + for row in range(35): + for column in range(row + 6): + x = (34 - column) * 10 + 905 + y = row * 10 + 305 arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) - pass - From 3d2cc83d003b66929ebe0c775bd52e3600598cfa Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Wed, 7 Dec 2022 16:27:57 +0200 Subject: [PATCH 28/32] section_8_finish --- Lab 05 - Loopy Lab/lab_05.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index cda3c07ea..5dcd8bf57 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -122,7 +122,6 @@ def draw_section_7(): arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) pass - def draw_section_8(): for row in range(35): for column in range(row + 6): From 548dd7dc9b3190dab5672f925a95afead13b49b4 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Fri, 9 Dec 2022 09:37:11 +0200 Subject: [PATCH 29/32] 123 --- Scratch work/1.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ Scratch work/1.py b/ Scratch work/1.py index d00c60b82..e4f56cd54 100644 --- a/ Scratch work/1.py +++ b/ Scratch work/1.py @@ -1,7 +1,2 @@ -for row in range(10): - - - for column in range(1, row + 1): - print(column, end=" ") - - print() \ No newline at end of file +var_ls = !ls -l +type(var_ls) \ No newline at end of file From c247cdf58d3860ecb57aa1714963a89685f2be83 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Fri, 9 Dec 2022 09:52:43 +0200 Subject: [PATCH 30/32] fin --- Lab 05 - Loopy Lab/lab_05.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index 5dcd8bf57..64b849670 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -122,12 +122,13 @@ def draw_section_7(): arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) pass + def draw_section_8(): - for row in range(35): - for column in range(row + 6): - x = (34 - column) * 10 + 905 - y = row * 10 + 305 - arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) + for row in range(35): + for column in range(row + 6): + x = (34 - column) * 10 + 905 + y = row * 10 + 305 + arcade.draw_rectangle_filled(x, y, 5, 5, arcade.color.WHITE) From e840042ac3bc11e1b52e7f728076c8c1d03a6e07 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Mon, 6 Mar 2023 16:04:36 +0200 Subject: [PATCH 31/32] 111 --- Lab 04 - Camel/12month_2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lab 04 - Camel/12month_2.py b/Lab 04 - Camel/12month_2.py index e41d5934e..c7ee1a256 100644 --- a/Lab 04 - Camel/12month_2.py +++ b/Lab 04 - Camel/12month_2.py @@ -2,4 +2,3 @@ n = int(input("Enter a month number: ")) selected_month = [months[i:i+3] for i in range(0, len(months), 3)][n-1] print('selected month is: ', selected_month) -5 \ No newline at end of file From a3af9e337fac9b9f7222dd55b88e69cab8290877 Mon Sep 17 00:00:00 2001 From: RosikOsad Date: Wed, 30 Aug 2023 14:40:09 +0300 Subject: [PATCH 32/32] bot = new --- .vscode/launch.json | 16 ++++++++++++++++ Lab 01 - First Program/1.py | 19 +++++++------------ Lab 12 - Final Lab/rand.py | 11 +++++++++++ Python BOT/bot.py | 23 +++++++++++++++++++++++ 4 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 Lab 12 - Final Lab/rand.py create mode 100644 Python BOT/bot.py diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..dc1dba186 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Используйте IntelliSense, чтобы узнать о возможных атрибутах. + // Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов. + // Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: текущий файл", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/Lab 01 - First Program/1.py b/Lab 01 - First Program/1.py index bd4941a45..ad23dd692 100644 --- a/Lab 01 - First Program/1.py +++ b/Lab 01 - First Program/1.py @@ -1,13 +1,8 @@ -""" -This is a sample program to show how to draw using the Python programming -language and the Arcade library. -""" +print ("fdghhh") +print("vvedit parol") +pas = input("vvedit pas") +if pas == "secret": + print("dostup vidkruto") +input("press enter") -# Import the "arcade" library -import arcade - -# Open up a window. -# From the "arcade" library, use a function called "open_window" -# Set the dimensions (width and height) -# Set the window title to "Drawing Example" -arcade.open_window(600, 600, "Drawing Example") \ No newline at end of file + diff --git a/Lab 12 - Final Lab/rand.py b/Lab 12 - Final Lab/rand.py new file mode 100644 index 000000000..6723fd3d9 --- /dev/null +++ b/Lab 12 - Final Lab/rand.py @@ -0,0 +1,11 @@ +import random +# создаємо випадкові числа із діапазона 1-6 +die1 = random.randint(1, 20) +die2 = random.randrange(1, 20) +total = die1 + die2 +print("При викиданні випало", die1, "і", die2, "очки в сумі", total) +input("\n\nНатисніть Enter щоб вийти") +def input(text): + print(text) + return input() + diff --git a/Python BOT/bot.py b/Python BOT/bot.py new file mode 100644 index 000000000..f28d464da --- /dev/null +++ b/Python BOT/bot.py @@ -0,0 +1,23 @@ +import telebot +import webbrowser + +bot = telebot.TeleBot('6592923965:AAEIeb25-IgwOT3oDjb30CGK07LcijcO1KQ') + +@bot.message_handler(commands=["site", "website"]) +def site(message): + webbrowser.open("https://core.telegram.org/api") + +@bot.message_handler(commands=["start"]) +def main(message): + bot.send_message(message.chat.id, f"Welcome, {message.from_user.first_name} {message.from_user.last_name}" ) + +@bot.message_handler() +def info(message): + if message.text.lower() == "welcome": + bot.send_message(message.chat.id, f"Welcome, {message.from_user.first_name} {message.from_user.last_name}") + elif message.text.lower() == "id": + bot.reply_to(message, f"ID: {message.from_user.id}") + +bot.polling(none_stop=True, interval=0) + +