12311k

Untitled

Apr 8th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. def is_anyone_in(collection, city):
  2. if city in collection.values():
  3. for i in collection:
  4. if collection[i] == city:
  5. print('В городе ' + city + ' живёт ' + i + '.')
  6. else:
  7. print('Пока никого.')
  8.  
  9.  
  10. friends = {
  11. 'Серёга': 'Омск',
  12. 'Соня': 'Москва',
  13. 'Дима': 'Челябинск',
  14. 'Алина': 'Хабаровск',
  15. 'Егор': 'Пермь'
  16. }
  17.  
  18. is_anyone_in(friends, 'Хабаровск')
  19.  
  20. # В городе Хабаровск живёт Алина.
Add Comment
Please, Sign In to add comment