The safest and more convinient way for students is to install Anaconda. The package is "isolated" full Python ecosystem with bunch of 3th party modules, package manage and so on.
The students can run, test and do all they want with the code.
Quote:Anaconda is a free, easy-to-install package manager, environment manager, Python distribution, and collection of over 720 open source packages with free community support. Hundreds more open source packages and their dependencies can be installed with a simple “conda install [packagename]”. It’s platform-agnostic, can be used on Windows, OS X and Linux. Or even easier, with new Anaconda Navigator for point and click install of environments and packages!
The students can run, test and do all they want with the code.