-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (19 loc) · 665 Bytes
/
app.py
File metadata and controls
24 lines (19 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Project B — Simple data processing API."""
def process_data(items):
"""Process a list of items and return summary stats."""
if not items:
return {"count": 0, "total": 0, "average": 0}
total = sum(items)
return {
"count": len(items),
"total": total,
"average": round(total / len(items), 2),
}
def filter_items(items, min_value=None, max_value=None):
"""Filter items by min/max value range."""
result = items
if min_value is not None:
result = [x for x in result if x >= min_value]
if max_value is not None:
result = [x for x in result if x <= max_value]
return result