Using a while loop and an accumulator variable to sum an unknown number of inputs

Опубликовано: 19 Ноябрь 2024
на канале: PatchyPython
117
0

Jupyter Notebook on Google Colab: https://tinyurl.com/5awxwpn3
(Bioinfo track: https://tinyurl.com/yckxbptr )

We compute the sum total of an unknown number of values using an "accumulator" variable to keep a running total. A "while" loop is a natural choice in this case, as it allows us to go around for more input until the user says stop.

Embedded video, part of the following courses:
Computer Programming at Queen Mary, University of London
Coding for Scientists at Queen Mary, University of London

For the full context, see the notebooks linked above.