Advertisement
Avrelii

Untitled

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