This file contains 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 | |
import requests | |
import typing as t | |
import time | |
from datetime import datetime, date | |
MONO_ENDPOINT = "https://api.monobank.ua/" | |
MY_TOKEN = "some_very_secret_token" | |
INVOICE_PATH = "/personal/statement/0/{from_ts}" |
This file contains 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 re | |
import sys | |
MAX_INT = sys.maxsize | |
def get_time_from_string(time_string): | |
time_value = "".join(re.split("[a-zA-Z]", time_string)) | |
time_format = "".join(re.split('\d+:\d+', time_string)).lower() | |
[hours, minutes] = time_value.split(":") | |
hours = int(hours) if int(hours) < 12 else 0 |
This file contains 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 two_sum(arr): | |
desired_amount = arr.pop(0) | |
result = [] | |
while len(arr) > 0: | |
current_value = arr.pop(0) | |
search_value = desired_amount - current_value | |
if search_value in arr: | |
arr.remove(search_value) | |
result.append((current_value, search_value)) | |
return result |