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
4 changes: 4 additions & 0 deletions lesson_2/2-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_list = [22, 'editor', 887, 75.8, None]
for i in my_list:
print(f"{i}-{type(i)}")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено

4 changes: 4 additions & 0 deletions lesson_2/2-2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_list = list(input("Введите целые числа через пробел: ").split())
for i in range(1, len(my_list), 2):
my_list.insert(i-1, my_list.pop(i))
print(my_list)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено

23 changes: 23 additions & 0 deletions lesson_2/2-3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# dict

month = int(input('Введите номер месяца: '))

month_list = {1: 'Зима', 2: 'Зима', 12: 'Зима',
3: 'Весна', 4: 'Весна', 5: 'Весна',
6: 'Лето', 7: 'Лето', 8: 'Лето',
9: 'Осень', 10: 'Осень', 11: 'Осень'}

for key, value in month_list.items():
if key == month:
print(f'Результат через словарь: {value}')


# list

month_list = [None, 'Январь Зима', 'Февраль Зима', 'Март Весна', 'Апрель Весна', 'Май Весна', 'Июнь Лето',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено, но вопрос для чего здесь элемент None,
его нужно убрать

'Июль Лето', 'Август Лето', 'Сентябрь Осень', 'Октябрь Осень', 'Ноябрь Осень', 'Декабрь Зима']

for i in month_list:
if month_list.index(i) == month:
print(f'Результат через список: {i}')

4 changes: 4 additions & 0 deletions lesson_2/2-4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
user_str = list(input('Введети строку из нескольких слов, разделённых пробелами: ').split())

for i in range(len(user_str)):
print(i + 1, ')', user_str[i][:10])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено

12 changes: 12 additions & 0 deletions lesson_2/2-5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
my_list = [7, 5, 3, 3, 2]

user_number = float(input('Введите число от 0 до 100: '))
i = 0
for n in my_list:
if user_number <= n:
i += 1
else:
break

my_list.insert(i, user_number)
print(my_list)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет задачи 6