diff --git a/ Scratch work/1.py b/ Scratch work/1.py new file mode 100644 index 000000000..e4f56cd54 --- /dev/null +++ b/ Scratch work/1.py @@ -0,0 +1,2 @@ +var_ls = !ls -l +type(var_ls) \ No newline at end of file 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/.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.swp b/Lab 01 - First Program/.1.py.swp new file mode 100644 index 000000000..c046f0b39 Binary files /dev/null and b/Lab 01 - First Program/.1.py.swp differ diff --git a/Lab 01 - First Program/1.py b/Lab 01 - First Program/1.py new file mode 100644 index 000000000..ad23dd692 --- /dev/null +++ b/Lab 01 - First Program/1.py @@ -0,0 +1,8 @@ +print ("fdghhh") +print("vvedit parol") +pas = input("vvedit pas") +if pas == "secret": + print("dostup vidkruto") +input("press enter") + + diff --git a/Lab 01 - First Program/lab_01.py b/Lab 01 - First Program/lab_01.py index e69de29bb..834f78449 100644 --- a/Lab 01 - First Program/lab_01.py +++ b/Lab 01 - First Program/lab_01.py @@ -0,0 +1,50 @@ +# 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/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 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 e69de29bb..36096e06a 100644 --- a/Lab 03 - Draw Using Functions/lab_03.py +++ b/Lab 03 - Draw Using Functions/lab_03.py @@ -0,0 +1,41 @@ +# 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) + +arcade.draw_arc_outline(300, + 340, + 70, + 50, + arcade.csscolor.BLACK, + 20, + 180, + 3, + 0) +# --- Finish drawing --- +arcade.finish_render() + +# Keep the window up until someone closes it. +arcade.run() \ No newline at end of file diff --git a/Lab 04 - Camel/1-9_romb.py b/Lab 04 - Camel/1-9_romb.py new file mode 100644 index 000000000..530735d17 --- /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 row2 in range (10): + + for space2 in range(row2 + 2): + print(" ", end=" ") + for column2 in range(1, 9 - row2 ): + print(column2, end=" ") + for column2 in range(7 - row2, 0, -1): + print(column2, end=" ") + + + print() 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..c7ee1a256 --- /dev/null +++ b/Lab 04 - Camel/12month_2.py @@ -0,0 +1,4 @@ +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) diff --git a/Lab 04 - Camel/lab_04.py b/Lab 04 - Camel/lab_04.py index e69de29bb..6d5a7e040 100644 --- a/Lab 04 - Camel/lab_04.py +++ b/Lab 04 - Camel/lab_04.py @@ -0,0 +1,88 @@ +import random +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 + way_miles = 0 + camael_tired = 0 + water_balance = 0 + water_botles = 4 + tusems_way = -20 + + while not done: + + choise = (input(""" + A. Выпить воды с запасов. + B. Двигаться вперед. + C. Двигаться вперед на полной скорости. + D. Остановиться на ночь. + E. Проверить статус. + Q. Выйти. + + Сделайте свой выбор? """)) + if choise.upper() == "Q": + done = True + print("Вы вышли") + elif choise.upper() == "E": + 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 + + + + + + + + +main() \ No newline at end of file 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() + 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 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() + + + + diff --git a/Lab 05 - Loopy Lab/lab_05.py b/Lab 05 - Loopy Lab/lab_05.py index e69de29bb..64b849670 100644 --- a/Lab 05 - Loopy Lab/lab_05.py +++ b/Lab 05 - Loopy Lab/lab_05.py @@ -0,0 +1,160 @@ +import arcade + + +def draw_section_outlines(): + # Draw squares on bottom + 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) + + # 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 = 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) + + + + + + +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. + pass + + +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 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 = 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(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) + + + +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 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) + + 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