Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Discussion Due Feb 24
Image: ubuntu2004
Kernel: Python 3 (system-wide)
There are two types of common loops in Python
"While Loops" and "For Loops"
If you wish to repeat a process until a certain requirement is met then it is best to use a "While Loop"
Consider we wish to sum up the values 1-5:
In [1]:
This Code will repeat WHILE
In [2]:
Out[2]:
15
15 is correctly produced by this code
What about using a FOR loop?
A "For Loop" is best when you know the number of iterations you want your code to run
In [3]:
Out[3]:
15
In [0]: