sentence = input('Введіть речення: ')
words = sentence.lower().split()
unique_words = set(words)
print(f'Унікальних слів: {len(unique_words)}')
print(sorted(unique_words))
friends_alice = {'Іван', 'Марія', 'Петро', 'Ольга'}
friends_bob = {'Марія', 'Сергій', 'Ольга', 'Діма'}
print('Спільні друзі:', friends_alice & friends_bob)
print('Тільки в Аліси:', friends_alice - friends_bob)
print('Тільки в Боба:', friends_bob - friends_alice)
print('Усі друзі:', friends_alice | friends_bob)
products = [
('Хліб', 50, 2),
('Молоко', 80, 3),
('Сир', 350, 1),
('Яблука', 120, 4),
('Чай', 150, 2)
]
print(f'{"Товар":<12} {"Ціна":>8} {"К-сть":>8} {"Сума":>8}')
print('-' * 38)
total = 0
for name, price, qty in products:
subtotal = price * qty
total += subtotal
print(f'{name:<12} {price:>8} {qty:>8} {subtotal:>8}')
print('-' * 38)
print(f'{"РАЗОМ:":<12} {"": >8} {"": >8} {total:>8}')
expensive = max(products, key=lambda p: p[1])
print(f'Найдорожчий: {expensive[0]} ({expensive[1]} грн.)')