Skip to content
Merged
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
93 changes: 93 additions & 0 deletions day-03/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Day 03 – Strengthening Python Fundamentals for DevOps

## Task

Today’s goal is to **improve and refine your existing Python scripts** using better structure and basic error handling.

You will take **any one script** from:
- Day 01 (System Health Script), or
- Day 02 (API & JSON Script)

And enhance it by:
- Organizing the code into **functions**
- Adding **basic exception handling** (`try / except`)
- Improving variable names and readability
- Ensuring the script does not crash on common errors

This task focuses on writing **cleaner and safer Python code**, which is critical for DevOps automation.


## Expected Output

- One improved Python script
- Script should:
- Run without crashing
- Handle at least one error gracefully
- Output should be visible in terminal



## Guidelines

- Use:
- `try / except` for error handling
- Functions to separate logic
- Example errors to handle:
- Invalid user input
- API request failure
- File not found
- Follow basic Python coding standards (PEP8)
- Do not rewrite everything from scratch
- Focus on **improving existing code**



## Resources

- Python exception handling:
https://docs.python.org/3/tutorial/errors.html

- PEP8 – Python Style Guide (must read):
https://peps.python.org/pep-0008/

- Python Best Practices (read selectively):
https://docs.python-guide.org/writing/style/

- Refactoring basics (from live class)
- Your Day 01 / Day 02 scripts


## Why This Matters for DevOps

In real-world DevOps:
- Scripts run in production
- Failures are common (network, permissions, input errors)
- Code is often read and modified by others

Following PEP8 and best practices makes your automation:
- Easier to debug
- Easier to maintain
- Safer to run in production environments


## Submission

1. Update your existing scripts from `day-01` and `day-02` and update it inside the `day-03` folder
2. Ensure the script runs successfully
3. Commit and push your changes to your fork


## Learn in Public

Share your progress on LinkedIn:
- Post a small code snippet showing improved structure or error handling
- Mention how you applied PEP8 or best practices
- Write 2–3 lines on what you learned today

Optional:
- Tag **TrainWithShubham** or **Shubham Londhe**
- Use hashtags: `#PythonForDevOps #TrainWithShubham #DevOpsKaJosh` (Helps me to filter post and Like/ Comment / Repost / engage)


Happy Learning
[TrainWithShubham](https://www.trainwithshubham.com/)