Skip to content

💡[Feature]: Add Python Exception Handling (try...except) #658

@Yash456k

Description

@Yash456k

Is there an existing issue for this?

  • I have searched the existing issues

Feature Description

This feature request is to add a new documentation page covering Exception Handling in Python. The page would be a new markdown file, python-exceptions.md, that explains how to manage errors. It is mentioned briefly in the "Typecasting" portion of the course

(ref :

Use `try`/`except` to handle safely:
```python
value = "abc"
try:
number = int(value)
except ValueError:
print("Invalid conversion")
```
)

but I think a dedicated section for it with examples might work better.

Topics include :

  • The purpose of the try...except block.
  • How to catch specific exceptions (e.g., ValueError, ZeroDivisionError).
  • The use of the optional else clause.
  • The use of the finally clause for cleanup actions.

Use Case

Makes the python section more complete and comprehensive.

Benefits

Completes the curriculum

Add ScreenShots

No response

Priority

Low

Record

  • I have read the Contributing Guidelines
  • Are you a GSSOC'25 contributor
  • I want to work on this issue

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions