This commit is contained in:
2021-07-31 17:10:28 +04:00
commit 8eaa630f67
12 changed files with 337 additions and 0 deletions

14
ch5/avatar.py Normal file
View File

@@ -0,0 +1,14 @@
def get_attribute(query, default):
question = query + ' [' + default + ']? '
answer = input(question)
if answer == '':
answer = default
print('Вы выбрали', answer)
return answer
hair = get_attribute('Цвет волос', 'темные')
hair_lenght = get_attribute('Длина волос', 'короткие')
eye = get_attribute('Цвет глаз', 'голубые')
gender = get_attribute('Пол', 'женский')
glasses = get_attribute('Носит очки', 'нет')
beard = get_attribute('Носит бороду', 'нет')

11
ch5/bark.py Normal file
View File

@@ -0,0 +1,11 @@
def bark(name, weight):
if weight > 20:
print(name, 'говорит ГАВ-ГАВ')
else:
print(name, 'говорит гав-гав')
bark('Тузик', 40)
bark('Смайли', 9)
bark('Джексон', 12)
bark('Филя', 65)