Besides the code itself, the only real difference between a
bash Slurm script and a Python or R Slurm script, is the hash-bang
statement!
You can change the hash-bang statement to the python or
Rscript interpreter you wish to use, or you can make use of
/usr/bin/env python to determine which interpreter to use
from your environment.
When using Slurm environment variables in a Python or R script, the
same environment variables are available to you, but you must access
them in the Python/R way.
Using Python or R Slurm scripts means you can
program in a language more familiar to you
make use of their broad functionality and packages
remove the need to have a wrapper Slurm script around your Python/R
scripts.