DEV Community

Nivedya AV
Nivedya AV

Posted on

Building an Advanced URL Shortener & ASCII QR Code Generator From Scratch Using Pure Python

Hello DEV Community!

I am a BCA Student, currently learning and building in public to pursue my dream of becoming a Web Advocate. Today, I want to share my latest project: an Advanced URL Shortener & ASCII QR Code Generator built completely from scratch!

Building this tool with zero external dependencies required careful algorithmic thinking. Here is how i structured the logic into 116 lines of clean Python code:

The Logic Breakdown & Core Features

  1. ** Smarter URL Validation: **
    Before processing any link, the program implements custom validation logic to check if the user input starts with http://. If it doesn't, the tool prompts the user with a helpful error message to prevent dead or unsafe links.

  2. ** Custom URL Shortening: **The script simulates backend link mapping by creating short, unique paths for long URLs.

  3. ** ASCII QR Code Array Logic: **instead of installing a massive image library, I created a grid matrix mechanism to dynamically print a scannable ASCII QR code using block characters directly inside the terminal window.

  4. ** Positioning Corner Markers: **implemented an add_marker() helper function that precisely places 7x7 finder patterns at the three corners of the grid matrix.

key Takeaways

This project gave me a deeper understanding of input validation, array manipulations, and character-mapping for console UIs.

Check out the full repository here:
https://github.com/nivedya2008/my-python-project

Top comments (0)