Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

homework lesson 3 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
11 changes: 11 additions & 0 deletions task_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def func(v1, v2):
return v1 / v2


v1 = int(input('введите число: '))
v2 = int(input('введите число: '))

if v2 == 0:
print('на 0 делить нельзя')
else:
print(func(v1, v2))
6 changes: 6 additions & 0 deletions task_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def data(**kwargs):
return ' '.join(kwargs.values())


print(data(name=input('введите имя: '), surname=input('введите фамилию: '), email=input('введите email: '),
yearBirth=input('введите год рождения: '), city=input('введите город проживания: ')))
10 changes: 10 additions & 0 deletions task_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def my_func(f1, f2, f3):
my_list = [f1, f2, f3]
try:
my_list.remove(min(my_list))
return sum(my_list)
except TypeError:
print('вводите числа')


print(my_func(2, 5, 58))
4 changes: 4 additions & 0 deletions task_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def my_func(v1, v2):
return (1 / (v1 ** abs(v2)))

print(my_func(int(input('введите число ')), int(input('введите отрицательное число '))))
16 changes: 16 additions & 0 deletions task_5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def sum():
number = 0
while True:
list = input('вводите числа, для выхода - Q: ').split()
for item in list:
if item == "Q":
return number
else:
try:
number += int(item)
except ValueError:
print('для выхода надо жать Q. Большое Q')
print(f'сумма чисел - {number}')


print(sum())
9 changes: 9 additions & 0 deletions task_6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def int_func():
for text in input('введите слова с пробелом из маленьких латинских букв: ').split():
chars = 0
for char in text:
if 97 <= ord(char ) <= 122:
chars += 1
print(text.title())

int_func()