Fading Coder

One Final Commit for the Last Sprint

Python Development Environment Setup and Basic Programming Practice

Lab Objectives Configure Python development environment including Python interpreter and PyCharm IDE Practice program execution and debugging techniques Implement a number guessing game to exercise variable usage, data types, string handling, object concepts, indentation, and commenting Learn Git ve...

Implementing Image Semantic Segmentation and Object Detection with Python

Image semantic segmentation and object detection are two key tasks in computer vision. Semantic segmentation classifies each pixel in an image into a specific category, while object detection identifies objects and determines their locations. This guide demonstrates how to implement both tasks using...

Essential PyTorch Techniques for Deep Learning Implementation

Core Development Tools dir(): Inspect object attributes help(): Access official documentasion Data Loading Fundamentals import os from torch.utils.data import Dataset from PIL import Image class CustomDataset(Dataset): def __init__(self, base_dir, category_dir): self.base_path = base_dir self.catego...

Six Essential Python Data Structure Techniques for Better Code

1. Named Tuples Named tuples allow you to assign meaningful names to tuple elements, significantly improving code readability. Problem Statement Consider a student information system where data follows a fixed format: (name, age, gender, email, ...). When dealing with large datasets, tuples are more...

Understanding Python Function Parameter Types

Formal vs. Actual Parameters Formal parameters are defined in the function signature and used within the function body, while actual parameters are the values passed during a function call. def display_stars(num_stars): for star in range(num_stars): print('*') display_stars(5) In this example, num_s...

Converting Decimal Numbers to Hexadecimal Using Python Loops

Implementing a decimal to hexadecimal conversion manually in Python requires careful handling of division and remainder operations. The process involves repeatedly dividing the decimal number by 16, collecting remainders, and convertign them to hexadecimal digits. A common challenge is that remainde...

Understanding Python Decorators: A Practical Guide for Test Automation Development

Decorators in Python provide a powerful mechanism for modifying or enhancing function behavior without altering the original code. This feature proves particularly valuable in test automation scenarios where common functionality needs to be shared across multiple test cases. A decorator is essential...

Identifying Gems in a Collection Using Hash Sets

Problem OverviewGiven a string gem_types representing the different categories of precious stones, and another string inventory representing the stones in your possession, determine how many of the stones you own are actually precious. Each character in inventory represents a single stone.Constraint...

Practical Cryptography and Network Security Techniques in Python

import hashlib # Secure password hashing with salt and iteration secret = b'base_secret' salt = b'random_salt_2024' iterations = 100_000 hashed = hashlib.pbkdf2_hmac('sha256', b'user_password', salt, iterations) print(f'PBKDF2 hash (hex): {hashed.hex()[:32]}...') # Verification logic using constant-...

Building Asynchronous Web APIs Using FastAPI

FastAPI leverages Starlette and Pydantic to deliver high-performance Web API development in Python. Its asynchronous support and automatic data validaiton make it suitable for modern microservices architectures. Environment Configuration Install the core framework using the package manager: pip inst...