Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
16d6e67
Create Lesson_01.py
evgeniypogoreliy Jan 25, 2023
3a32f48
Create Lesson_02.py
evgeniypogoreliy Jan 25, 2023
babb021
Create Lesson_03.py
evgeniypogoreliy Jan 25, 2023
13f9556
Create Lesson_04.py
evgeniypogoreliy Jan 25, 2023
cd586db
Create Lesson_05.py
evgeniypogoreliy Jan 25, 2023
cac1425
Create Lesson_06.py
evgeniypogoreliy Jan 25, 2023
4124c0e
Create Lesson_07.py
evgeniypogoreliy Jan 25, 2023
98980b1
Practical work 4
evgeniypogoreliy Jan 30, 2023
b173d00
Practical work 4
evgeniypogoreliy Jan 30, 2023
55b912b
Practical work 4
evgeniypogoreliy Jan 30, 2023
203d39f
Practical work 4
evgeniypogoreliy Jan 30, 2023
6ffa361
Practical work 4
evgeniypogoreliy Jan 30, 2023
8c7f74d
Practical work 4
evgeniypogoreliy Jan 30, 2023
fa4a73c
Practical work 4
evgeniypogoreliy Jan 30, 2023
1a74dae
Delete Lesson_01.py
evgeniypogoreliy Feb 2, 2023
56a112e
Delete Lesson_02.py
evgeniypogoreliy Feb 2, 2023
6a15565
Delete Lesson_03.py
evgeniypogoreliy Feb 2, 2023
37852ee
Delete Lesson_04.py
evgeniypogoreliy Feb 2, 2023
d984c17
Delete Lesson_05.py
evgeniypogoreliy Feb 2, 2023
f3ee376
Delete Lesson_06.py
evgeniypogoreliy Feb 2, 2023
307bea5
Delete Lesson_07.py
evgeniypogoreliy Feb 2, 2023
7563fec
Practical work 5
evgeniypogoreliy Feb 2, 2023
77f1868
Practical work 5
evgeniypogoreliy Feb 2, 2023
fa49010
Practical work 5
evgeniypogoreliy Feb 2, 2023
f03e726
Practical work 5
evgeniypogoreliy Feb 2, 2023
91c4d1c
Practical work 5
evgeniypogoreliy Feb 2, 2023
b0f4953
Practical work 5
evgeniypogoreliy Feb 2, 2023
03dbe20
Practical work 5
evgeniypogoreliy Feb 2, 2023
2459f00
Delete Less_7.py
evgeniypogoreliy Feb 7, 2023
6ec341a
Delete Less_6.py
evgeniypogoreliy Feb 7, 2023
13490ad
Delete Less_5.py
evgeniypogoreliy Feb 7, 2023
cd6e9b0
Delete Less_4.py
evgeniypogoreliy Feb 7, 2023
52539fd
Delete Less_3.py
evgeniypogoreliy Feb 7, 2023
af888a8
Delete Less_2.py
evgeniypogoreliy Feb 7, 2023
e4812f6
Delete Less_1.py
evgeniypogoreliy Feb 7, 2023
9a605ab
Practical work 6
evgeniypogoreliy Feb 7, 2023
661408b
Practical work 6
evgeniypogoreliy Feb 7, 2023
44cdd5e
Practical work 6
evgeniypogoreliy Feb 7, 2023
3a69e72
Practical work 6
evgeniypogoreliy Feb 7, 2023
b0efbf8
Practical work 6
evgeniypogoreliy Feb 7, 2023
bff2bd0
Delete Less_5.py
evgeniypogoreliy Feb 10, 2023
0c8864b
Delete Less_4.py
evgeniypogoreliy Feb 10, 2023
10e0d38
Delete Less_3.py
evgeniypogoreliy Feb 10, 2023
92e5ee1
Delete Less_2.py
evgeniypogoreliy Feb 10, 2023
815dbcd
Delete Less_1.py
evgeniypogoreliy Feb 10, 2023
6ea7028
Practical work 7
evgeniypogoreliy Feb 10, 2023
92f8ea5
Practical work 7
evgeniypogoreliy Feb 10, 2023
88c059b
Practical work 7
evgeniypogoreliy Feb 10, 2023
17e9197
Delete Less_1.py
evgeniypogoreliy Feb 12, 2023
a903767
Delete Less_2.py
evgeniypogoreliy Feb 12, 2023
8c09661
Delete Less_3.py
evgeniypogoreliy Feb 12, 2023
146cfe4
Practical work 8
evgeniypogoreliy Feb 12, 2023
6c65765
Practical work 8
evgeniypogoreliy Feb 12, 2023
f729457
Practical work 8
evgeniypogoreliy Feb 12, 2023
1ddac2a
Practical work 8
evgeniypogoreliy Feb 12, 2023
31e3768
Practical work 8
evgeniypogoreliy Feb 12, 2023
4bd25a9
Practical work 8
evgeniypogoreliy Feb 12, 2023
ec9cefd
Praticical work 8
evgeniypogoreliy Feb 12, 2023
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
16 changes: 16 additions & 0 deletions Lesson_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 1. Реализовать функцию, принимающую два числа (позиционные аргументы)
# и выполняющую их деление. Числа запрашивать у пользователя, предусмотреть
# обработку ситуации деления на ноль.

def div(x, y):
res: int
error: str = 'Вы ввели не корректные числа.'
if x > 0 and y >0:
res = x/y
return res
else:
return error
var_input_first = int(input('Введите первое число: '))
var_input_second = int(input('Введите второе число: '))

print(div(var_input_first, var_input_second))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  1. валидацию нужно делать через try except
  2. y >0:
    res = x/y
    проверьте все листинги на пеп-8

18 changes: 18 additions & 0 deletions Lesson_02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 2. Выполнить функцию, которая принимает несколько параметров, описывающих
# данные пользователя: имя, фамилия, год рождения, город проживания, email,
# телефон. Функция должна принимать параметры как именованные аргументы.
# Осуществить вывод данных о пользователе одной строкой.

def person(name, sec_name, age, city, email, tel):
return f'Имя - {name}, фамилия - {sec_name}, год рождения - {age}, город проживания - {city}, ' \
f'email - {email}, телефон {tel}'


name = input('Введите имя: ')
sec_name = input('Введите Фамилию: ')
age = input('Введите год рождения: ')
city = input('Введите город проживания: ')
email = input('Введите email:')
tel = input('Введите телефон: ')

print(person(name, sec_name, age, city, email, tel))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

не выполнено
ункция должна принимать параметры как именованные аргументы.

20 changes: 20 additions & 0 deletions Lesson_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 3. Реализовать функцию my_func(), которая принимает три позиционных
# аргумента и возвращает сумму наибольших двух аргументов.

def my_func(a, b, c):
sum: int
if a > b > c:
return a + b
elif a > c > b:
return a + c
elif b > c > a:
return b + c
elif c > b > a:
return c + b


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sum: int
что это?

a = int(input('Введите первое число: '))
b = int(input('Введите второе число: '))
c = int(input('Введите третье число: '))

print(my_func(a, b, c))
25 changes: 25 additions & 0 deletions Lesson_04.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 4. Программа принимает действительное положительное число x и целое
# отрицательное число y. Выполните возведение числа x в степень y.
# Задание реализуйте в виде функции my_func(x, y). При решении задания
# нужно обойтись без встроенной функции возведения числа в степень.
# Подсказка: попробуйте решить задачу двумя способами.
# Первый — возведение в степень с помощью оператора **.
# Второй — более сложная реализация без оператора **, предусматривающая
# использование цикла.

def my_func(x, y):
res = x ** y
return res
def my_func_cicle(x, y):
tmp = x
for i in range(1, y*(-1)):
tmp *= x
res = 1/tmp
return res


x = float(input('Введите действительное положительное число: '))
y = int(input('Введите целое отрицательное число: '))

print(f'Ответ с использывание встроеной функции {my_func(x, y)}')
print(f'Ответ с использованием цикла {my_func_cicle(x, y)}')
Copy link
Copy Markdown

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_05.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
5. Программа запрашивает у пользователя строку чисел, разделённых пробелом.
# При нажатии Enter должна выводиться сумма чисел. Пользователь может
# продолжить ввод чисел, разделённых пробелом и снова нажать Enter.
# Сумма вновь введённых чисел будет добавляться к уже подсчитанной сумме.
# Но если вместо числа вводится специальный символ, выполнение программы
# завершается. Если специальный символ введён после нескольких чисел,
# то вначале нужно добавить сумму этих чисел к полученной ранее сумме и
# после этого завершить программу.

def sum_input(s_input):
ls = list(map(int, s_input.split(' ')))
return sum(ls)


ex = False
res = 0
while not ex:
user_input = input('Введите строку чисел раделенных пробелом(для выхода введите q): ')
if user_input == 'q':
ex = True
else:
res += sum_input(user_input)
print(res)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

выполнено

11 changes: 11 additions & 0 deletions Lesson_06.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 6. Реализовать функцию int_func(), принимающую слова из маленьких латинских
# букв и возвращающую их же, но с прописной первой буквой.
# Например, print(int_func(‘text’)) -> Text.

def int_func(s):
return s.capitalize()


input_string = input('Введите слово латинскими буквами в нижнем регистре: ')

print(int_func(input_string))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

выполнено

15 changes: 15 additions & 0 deletions Lesson_07.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 7. Продолжить работу над заданием. В программу должна попадать строка из слов,
# разделённых пробелом. Каждое слово состоит из латинских букв в нижнем регистре.
# Нужно сделать вывод исходной строки, но каждое слово должно начинаться с
# заглавной буквы. Используйте написанную ранее функцию int_func().

def int_func(s):
res = ''
ls = list(map(str, s.split(' ')))
for i in ls:
res += ' ' + i.capitalize()
return res


input_string = input('Введите слово латинскими буквами в нижнем регистре: ')
print(int_func(input_string))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

выполнено