This repository contains solutions to a collection of beginner-to-intermediate Python programming exercises. The problems cover a wide range of topics, including functions, recursion, object-oriented programming, file I/O, HTML parsing, web scraping, SQL, and list comprehensions. This notebook serves as a comprehensive practice resource for learners who want to build a strong foundation in Python programming and basic data handling.
-
problemset2.ipynb
A Jupyter notebook with code-based solutions to several programming questions. Key topics include:- Function definitions and use of global variables
- Reading files with error handling
- Class creation and inheritance
- The Collatz sequence and recursion
- Parsing HTML using
HTMLParser - Basic web scraping using
BeautifulSoupandurllib - SQL query writing for typical data extraction tasks
- List comprehensions and data transformation
-
bloodtype1.txt
A sample text file used in Question 2 to demonstrate file handling and exception management. -
w3c.html
A static HTML file used in Question 6 for parsing headings with a custom parser.
Ensure you have Python 3.x and the following libraries installed:
beautifulsoup4urllib(part of Python’s standard library)html.parser(built-in)
To install required packages, run:
pip install beautifulsoup4- Clone the repository:
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name- Open the notebook using Jupyter:
jupyter notebook problemset2.ipynb- Run and explore each section of the notebook to deepen your understanding of core Python programming concepts.
- SQL queries assume a table named
weatherwith columns such asCity,Country,Season,Temperature, andRainfall. - Ensure internet access is available when running web scraping code that fetches content from live websites.
- All examples are written in Python 3.
By working through the notebook, you will:
- Strengthen your Python coding fundamentals
- Understand how to structure and inherit classes
- Learn to parse and analyze text and HTML content
- Apply recursion and file handling techniques
- Practice real-world data querying with SQL
- Gain confidence using Python's list comprehensions for efficient coding
Gratitude to all the online learning platforms and mentors who inspire continuous learning. This work builds on foundational exercises and projects typically found in Python programming courses and tutorials.