A Python Implementation of Set Theory


This week I spent some time to implement set theory fundamentals using Python. As COVID-19 is doing the rounds, chose the COVID-19 test kit clinical trials as a use-case.

A Jupyter notebook file has been embedded into this article. I used some Venn diagrams to illustrate the realtionship between the sets. We need to install a Python library to visualize the sets as Venn diagrams; execute following command to install matplotlib-venn library.

pip3 install matplotlib matplotlib-venn 

Download the IPYNB file to your system. In your terminal, change directory to the location where the file was downloaded to and run the Jupyter notebook by executing following command.

jupyter notebook

If you are using Jupyter lab

jupyter lab