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
9 changes: 9 additions & 0 deletions task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def division(num1, num2):
if num2 == 0:
return 'Division by zero!'
return num1 / num2


num1 = int(input('Введите первое число: '))
num2 = int(input('Введите второе число: '))
print(division(num1, num2))
11 changes: 11 additions & 0 deletions task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def user(
name='Имя',
surname='Фамилия',
birth_year='1990',
city='Москва',
email='test@test.ru',
phone='8 (999) 999 99-99'):
return f"{surname} {name}, {birth_year} года рождения, город {city}, E-mail: {email}, Телефон: {phone}"


print(user('Игорь', 'Назаров'))
8 changes: 8 additions & 0 deletions task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def my_func(x, y, z):
array = [x, y, z]
array.sort(reverse=True)
return array[0] + array[1]


res = my_func(11, 2, 4)
print(res)
14 changes: 14 additions & 0 deletions task4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def my_func(x, y):
if not isinstance(y, int) or y >= 0:
return 'Ошибка, введите целое отрицательное число'
ci = abs(y)
i = 0
result = 1
while i < ci:
result *= 1 / x
i += 1
return result
# Ну или просто x ** y :)


print(my_func(400, -1))
18 changes: 18 additions & 0 deletions task5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
total = 0


def sum_my_numbers(num_str, t):
numbers = num_str.split(' ')
for num in numbers:
if num == 'stop':
return t, True
t += int(num)
return t, False


while True:
numbers_str = input('Введите числа через пробел (чтобы остановиться, введите stop): ')
total, stop = sum_my_numbers(numbers_str, total)
print(total)
if stop:
break
15 changes: 15 additions & 0 deletions task6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def int_func(word):
return word.capitalize()


words = input('Введите слова через пробел: ')
words_split = words.split(' ')
title_words = []
for w in words_split:
title_word = int_func(w)
title_words.append(title_word)


print(' '.join(title_words))
# Либо еще проще
print(words.title())