Logical gates implemented in python