Skip to content

A hands-on Python project to explore exception handling using try-except, showcasing safe input validation and common error patterns.

Notifications You must be signed in to change notification settings

bonifasiusx/try-except-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Try-Except Demo in Python

This repository contains a collection of simple examples demonstrating how to use try-except blocks in Python. The code explores how exception handling works, when to use it, and what can go wrong if it's misused.

Purpose

This project was built as part of the Portofolio Build assignment in the Data Science Bootcamp at Purwadhika Digital Technology School. It aims to reinforce the importance of proper error handling in real-world programs.

Contributors

What You’ll Learn

  • How to use try, except, else, and finally
  • Why handling specific exceptions is better than a general except:
  • Examples of both good and bad usage of exception handling
  • How to avoid masking bugs with overly broad error handling

Files

  • try_except_demo.py – The main script with annotated examples

Related Article

This code is explained in detail in our Medium article:
Why Understanding Try-Except in Python is Essential for Every Programmer

Usage

Clone the repo and run the file:

python try_except_demo.py

About

A hands-on Python project to explore exception handling using try-except, showcasing safe input validation and common error patterns.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages