Skip to content

Instantly share code, notes, and snippets.

View isaacimholt's full-sized avatar
🐍
+ 🦀

Isaac Imholt isaacimholt

🐍
+ 🦀
View GitHub Profile
"""
Given a binary sequence X of length n, write an algorithm that prints all
non-decreasing sub-sequences that contain at least one 1 and 0.
"""
def backtracking(X):
def back(X, S, i, last_item, last_one):
# reached max length
from urllib import parse
base_str = "https://www.immobiliare.it/ricerca.php?"
toCheck = ['', '', '', '']
idContratto, minMQ, maxMQ, raggio = '', '', '', ''
coordinate = (0,0)
coord_str = ','.join(str(x) for x in coordinate)
args = {
def _bies_word(str: word) -> str:
if len(word) == 1:
return 'S'
return 'B' + ''.join('I' for _ in word[1:-1]) + 'E'
def _bies_line(str: line) -> str:
return ''.join(_bies_word(w) for w in line.split())
@isaacimholt
isaacimholt / filesorter.py
Last active December 26, 2019 13:00
sort files for byunw on /r/learnpython
import os
import shutil
# We define this mapping first to make adding new types easy.
# I've taken the liberty of adding support for some extra types.
folder_to_extensions = {
'PDF': {'pdf'},
'Documents': {'doc', 'docx'},
'Text': {'txt', 'rtf'},
'EXE': {'exe', 'msi'},