We intend to rely on https://github.com/mathbunnyru/python-cpp-extension . We also would to convert lists to sets and vice-versa and utilize method set1.difference(set2) . Sometimes Python tricks make you really excited
Download and extract tarball on Fedora 34 with "C Development tools" and python-devel installed . Setup python venv in your working directory
$ python3 -m venv .env
$ source .env/bin/activate
and run straight away:-
$ python setup.py install
(.env) [boris@fedora34server python-cpp-extension-delta]$ cat deltaBetween.py
import cpp_python_extension
uplimit,downlimit =0,0
znBig = []
znSmall = []
uplimit = int(input("Input upper bound :"))
downlimit = int(input("Input lower bound :"))
znBig = cpp_python_extension.sieve_of_eratosthenes(uplimit)
znSmall = cpp_python_extension.sieve_of_eratosthenes(downlimit)
setSmall = set(znSmall)
setBig = set(znBig)
deltaSet = setBig.difference(setSmall)
deltaList = list(deltaSet)
deltaList.sort()
print(deltaList)
No comments:
Post a Comment