Skip to content

Instantly share code, notes, and snippets.

@Akhira-dev
Akhira-dev / task_3_api_integrated.py
Created April 24, 2026 12:12
Python integration with Open-Meteo REST API. Demonstrates external API consumption, response transformation, timeout handling, connection resilience, and clean backend-oriented error management.
import requests
def get_weather(latitude=10.0, longitude=14.0, city="Unknown"):
"""
Récupère les données météo depuis Open-Meteo
et retourne une version simplifiée pour une application.
Args:
latitude (float): Latitude de la ville
@Akhira-dev
Akhira-dev / task2_rate_limited.py
Created April 24, 2026 12:10
Backend Technical Assessment - Python implementation of a sliding window rate limiter using deque and defaultdict. Efficiently processes user events and returns allowed/blocked decisions in linear time.
from collections import defaultdict, deque
def rate_limited(events, window=10):
"""
Determines whether each event is allowed or blocked based on a time window.
An event is blocked if the same userId has already had an event whitin the previous windows seconds.
Args:
events (list[tuple[int, str]]): List of (timestamp, userId)
@Akhira-dev
Akhira-dev / task1_find_pairs.py
Last active April 24, 2026 12:06
Python function to find all unique pairs of numbers whose sum equals a target value.
def find_pairs(arr, target):
"""
Find all pairs of distinct numbers whose sum equals a target value.
Each pair is unique(order is ignored and duplicates are removed).
Args:
arr (list[int]): List of integers to analyze.
target (int): Targed sum.