Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions task-1/output/clean_users.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"id": 1,
"name": "Alice Johnson",
"email": "alice.johnson@company.com",
"department": "Engineering",
"salary": 85000
},
{
"id": 2,
"name": "Bob Smith",
"email": "bob.smith@company.com",
"department": "Unknown",
"salary": 72000
},
{
"id": 3,
"name": "Carol Williams",
"email": "carol.williams@company.com",
"department": "Engineering",
"salary": null
},
{
"id": 4,
"name": "David, Jr.",
"email": "david.brown@company.com",
"department": "Sales",
"salary": 68000
},
{
"id": 5,
"name": "Caf\u00e9 Owner",
"email": "eva@company.com",
"department": "Engineering",
"salary": 88000
},
{
"id": 6,
"name": "FRANK WILSON",
"email": "frank@company.com",
"department": "marketing",
"salary": 95000
},
{
"id": 7,
"name": "Grace Lee",
"email": "grace.lee@company.com",
"department": "Engineering",
"salary": null
},
{
"id": 9,
"name": "Henry Davis",
"email": "henry.davis@company.com",
"department": "Sales",
"salary": 82000
},
{
"id": 11,
"name": "Linda Taylor",
"email": "linda.t@company.com",
"department": "HR",
"salary": 55000
},
{
"id": 12,
"name": "Mike Brown",
"email": "mike.b@company.com",
"department": "Sales",
"salary": null
},
{
"id": 13,
"name": "Sarah Connor",
"email": "s.connor@sky.net",
"department": "Unknown",
"salary": -1
},
{
"id": 15,
"name": "John Doe",
"email": "john.doe@company.net",
"department": "Engineering",
"salary": 100000
}
]
Binary file added task-1/src/__pycache__/utils.cpython-311.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions task-1/src/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
log = logging.getLogger(__name__)



def clean_row(row: dict[str, str]) -> dict | None:
"""Clean a single CSV row. Return None to skip the row (validation failed)."""
name = clean_name(row.get("name", ""))
Expand Down
27 changes: 27 additions & 0 deletions task-1/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def clean_name(raw: str) -> str:

Returns the cleaned string. An empty input returns "".
"""
if raw is None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DictReader values are usually strings, so better to use if not raw than if raw is None

return ""
return raw.strip()
raise NotImplementedError("Implement clean_name (Task 1)")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the NotImplementedError from your helpers since you've already added the functionality



Expand All @@ -21,6 +24,9 @@ def clean_email(raw: str) -> str:

Returns the cleaned string. An empty input returns "".
"""
if raw is None:
return ""
return raw.lower().strip()
raise NotImplementedError("Implement clean_email (Task 1)")


Expand All @@ -29,6 +35,12 @@ def clean_department(raw: str) -> str:

Strip whitespace; treat empty string as missing.
"""
if raw is None:
return "Unknown"
department = raw.strip()
if department =="":

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add spaces after ==

return "Unknown"
return department
raise NotImplementedError("Implement clean_department (Task 1)")


Expand All @@ -38,4 +50,19 @@ def clean_salary(raw: str) -> int | None:
Handles inputs like "85000", " 95000", '"68,000"', "N/A", "".
Returns None when the value cannot be parsed (missing or "N/A").
"""
if raw is None:
return None

salary = raw.strip()

salary = salary.replace('"','').replace(',','')

if salary =="" or salary == "N/A":
return None

try:
return int(salary)
except ValueError:
return None

raise NotImplementedError("Implement clean_salary (Task 1)")
38 changes: 38 additions & 0 deletions task-2/AI_DEBUG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,57 @@ Document one debugging session you had during Task 1 where you used an LLM

<!-- Paste the full traceback or describe the wrong behaviour. Include the
exact error message and the line of your code that triggered it. -->
Traceback (most recent call last):
File "/Users/barbari/Desktop/c55-data-week1/task-1/src/cleaner.py", line 17, in <module>
from utils import clean_department, clean_email, clean_name, clean_salary
File "/Users/barbari/Desktop/c55-data-week1/task-1/src/utils.py", line 65
expect ValueError:
^^^^^^

## The Prompt

<!-- The exact text you sent to the LLM. Include the code you pasted with
it. -->
I paseted the following error and code :

I am getting an error in my Python script.
What is the problem
This is the code :

try:
return int(salary)
expect ValueError:
return None


## The Solution

<!-- What did the LLM suggest? Did it work on the first try, or did you
need a follow-up? -->
The problem is a simple typo in your exception handling:

expect ValueError:

should be:

except ValueError:

So your corrected code is:

try:
return int(salary)
except ValueError:
return None

That’s it—except is the correct Python keyword.

yes it worked immediatly
## Reflection

<!-- A few sentences on: did you understand WHY the original code was
broken, or did you just accept the fix? What would you do differently next
time? -->
yes, the real issue was a syntax error. python doesnt recognize expect, only except so the code coudnt run at all .
next time i will focus on the syntax .


Binary file added task-3/azure_proof.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.