This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |