Files
temp_dump/zadanie.md
T
2026-10-22 07:45:09 +00:00

35 lines
956 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"Čo sa stane pri opakovanom volaní? Ako to opraviť?"
```python
def add_item(item, items=[]):
items.append(item)
return items
```
„Na čo slúži `if __name__ == "__main__":`?“
Zoznam leadov:
```python
leads = [
{"name": "Alice", "email": "ALICE@Example.com ", "company": "Acme"},
{"name": "Bob", "email": "bob@example.com", "company": "Beta"},
{"name": "Unknown", "email": "", "company": "Gamma"},
{"name": "Alice 2", "email": "alice@example.com", "company": "Acme"},
{"name": "No email"},
]
```
Napíš funkciu:
```python
def prepare_leads(leads):
...
```
ktorá:
1. odstráni leady bez platného e-mailu (pre účely testu stačí, že obsahuje `@`),
2. e-mail očistí (`strip`) a prevedie na lowercase,
3. odstráni duplicity podľa e-mailu – ponechá prvý výskyt,
4. pridá pole `personalization`, napr. `"Hello Alice, I noticed Acme."`,
5. vráti nový zoznam a **nemení pôvodný vstupný zoznam**.