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
""" | |
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 |
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 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 = { |
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 _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()) |
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 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'}, |