Date: 4/27/2020
Scenario:
- I want to have a single Interface Class that has a Base Implementation Class with multiple instance implementations for other Inheriting Classes
def distance(u, v): | |
""" | |
Calculates Euclidean distance between two point | |
distance = square_root( sum(u_i - v_i)^2 ) | |
u: [float, float], point1 | |
v: [float, float], point2 | |
""" | |
sum_ = sum((u[i] - v[i]) ** 2 for i in range(len(u))) | |
return sum_ ** (1 / 2) |
# --- Code Book: Python Algorithms | |
# --- Source : github.com/keon/algorithms.git | |
#======================================================================================================================== | |
# :: tree/path_sum.py :: | |
#======================================================================================================================== | |
| 1| """ | |
| 2| Given a binary tree and a sum, determine if the tree has a root-to-leaf | |
| 3| path such that adding up all the values along the path equals the given sum. | |
| 4| |
from __future__ import annotations | |
from functools import lru_cache, wraps | |
from psycopg2 import connect | |
from pandas import read_sql, DataFrame | |
class RedshiftDB: | |
"""Redshift Database Hook | |
USAGE: |