Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 02_lesson/lesson_2_task_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lst = ['🍇', '🍑', '🍐', '🍊', '🍌', '🍎']
print(lst[0], lst[-1])
11 changes: 11 additions & 0 deletions 02_lesson/lesson_2_task_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def is_year_leap(year):
if (year % 4 == 0):
print("Год " + str(year) + ":" + " True")
else:
("Год " + str(year) + ":" + " False")


num = int(input("Введите год"))


result = is_year_leap(num)
9 changes: 9 additions & 0 deletions 02_lesson/lesson_2_task_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import math


def square(side):
return math.ceil(side * side)


num_side = float(input("Сторона квадрата: "))
print(f"Площадь квадрата: {square(num_side)}")
16 changes: 16 additions & 0 deletions 02_lesson/lesson_2_task_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
n = int(input("Введите число:"))


def fizz_buzz(n):
for i in range(1, n + 1):
if i % 5 == 0 and i % 3 == 0:
print("FizzBuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print("i")


fizz_buzz(n)
18 changes: 18 additions & 0 deletions 02_lesson/lesson_2_task_5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def month_to_season(month):
if 1 <= month <= 2 or month == 12:
return "зима"
elif 3 <= month <= 5:
return "весна"
elif 6 <= month <= 8:
return "Лето"
elif 9 <= month <= 11:
return "Осень"
else:
return "Неверный номер месяца"


try:
month = int(input("Введите номер месяца (1-12): "))
print(month_to_season(month))
except ValueError:
print("Пожалуйста, введите целое число от 1 до 12.")
4 changes: 4 additions & 0 deletions 02_lesson/lesson_2_task_6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lst = [11, 5, 8, 32, 15, 3, 20, 132, 21, 4, 555, 9, 20]
answer = [x for x in lst if x < 30 and x % 3 == 0]

print(answer)
3 changes: 3 additions & 0 deletions 02_lesson/lesson_2_task_7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
my_list = list(range(18, 1, -4))

print(my_list)