-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
61 lines (41 loc) · 1.92 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import requests
from requests.exceptions import HTTPError
def greetings(name):
print(f'Здарова, {name}!')
def main():
name = input("Введите имя \n")
greetings(name)
def request():
try:
response = requests.get('https://api.github.com')
response.raise_for_status()
except HTTPError as http_err:
print(f'HTTP error occurred: {http_err}')
except Exception as err:
print(f'Other error occurred: {err}')
else:
print('Success!')
request()
def snow():
# создаем словарь/массив объектов с координатами
coords = [{'x': 100, 'y': 0}, {'x': 200, 'y': 0}, {'x': 300, 'y': 0}]
# инициализируем переменную - флаг для выхода из бесконечного цикла
isContinue = True
# запускаем "рендер" цикл
while isContinue:
# перебираем точки из массива
for point in coords:
# вывод точек для отладки
print(point)
# задаем новые координаты текущей точки (увеличиваем X , Y)
point['y'] = point['y'] + 50
point['x'] = point['x'] + 50
#рисуем точку (метод из либы)
#draw()
# после выполнения каждой итерации внешнего цикла проверяем Y координату любой точки, для остановки рендера
# это условие зависит от конкретной задачи в ТЗ
if point['y'] > 1000:
# просваиваем переменной/флагу значение false, что бы прервать выполнение бесконечного цикла
isContinue = False
# запуск функции
snow()