Загрузка данных


**Задание 1. Математический калькулятор**
```python
def calculate(operation, *args):
    if operation == "sum":
        return sum(args)
    elif operation == "product":
        result = 1
        for num in args:
            result *= num
        return result
    elif operation == "max":
        return max(args) if args else None
    elif operation == "min":
        return min(args) if args else None
    elif operation == "avg":
        return sum(args) / len(args) if args else None
    else:
        print("Ошибка: неизвестный режим")
        return None

print(calculate("sum", 1, 2, 3, 4))
print(calculate("product", 2, 3, 4))
print(calculate("avg", 10, 20, 30))
print(calculate("max", 5, 1, 9, 3))
print(calculate("unknown", 1, 2))

```
**Задание 2. Приветствие группы**
```python
def greet_all(greeting, *names):
    if not names:
        print("Некого приветствовать")
    else:
        for name in names:
            print(f"{greeting}, {name}!")

greet_all("Привет", "Анна", "Борис", "Вера")
greet_all("Добрый день")

```
**Задание 3. Карточка пользователя**
```python
def print_profile(**kwargs):
    if not kwargs:
        print("Профиль пуст")
    else:
        for key, value in kwargs.items():
            print(f"{key}: {value}")

print_profile(name="Алиса", age=20, city="Казань")
print_profile()

```
**Задание 4. Чек заказа**
```python
def print_order(customer, **items):
    print(f"Заказ для: {customer}")
    total_sum = 0
    for item, price in items.items():
        print(f"{item} — {price} руб.")
        total_sum += price
    print(f"Итого: {total_sum} руб.")

print_order("Иван", burger=250, fries=100, cola=80)

```
**Задание 5. Фильтр чисел**
```python
def filter_numbers(*args, min=None, max=None):
    filtered = []
    for num in args:
        if (min is None or num >= min) and (max is None or num <= max):
            filtered.append(num)
    return filtered

print(filter_numbers(3, 10, 7, 1, 15, 6, min=5, max=10))
print(filter_numbers(3, 10, 7, min=5))
print(filter_numbers(3, 10, 7))

```