Advertisement
praktikum

Untitled

Dec 25th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. FRIENDS = ['Серёга', 'Соня', 'Дима', 'Алина', 'Егор']
  2.  
  3.  
  4. def print_friends_count(friends_count):
  5. if friends_count == 1:
  6. print('У тебя 1 друг')
  7. elif 2 <= friends_count <= 4:
  8. print('У тебя ' + str(friends_count) + ' друга')
  9. elif friends_count >= 5:
  10. print('У тебя ' + str(friends_count) + ' друзей')
  11.  
  12.  
  13. def process_query(query):
  14. print("Привет, я Анфиса!")
  15. if query == 'Сколько у меня друзей?':
  16. count = len(FRIENDS)
  17. print_friends_count(count)
  18. elif query == 'Кто все мои друзья?':
  19. friends_string = ', '.join(FRIENDS)
  20. print('Твои друзья: ' + friends_string)
  21. else:
  22. print('<неизвестный запрос>')
  23.  
  24.  
  25. process_query('Сколько у меня друзей?')
  26. process_query('Как меня зовут?')
  27. process_query('Кто все мои друзья?')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement