Here I am going to show you a program that sums a range of numbers provided by the user. For this problem I used a loop, and I learned to do so in python from here: http://www.python-course.eu/python3_loops.php
I also had to use conditionals to make sure the first number the user entered was lower than the second, in order for the program to work correctly. Here is a flowchart explaining how conditionals work:
Which I got from another page that helped me understand both conditionals and loops:
http://www.openbookproject.net/books/bpp4awd/ch04.html
At the end, my program looked like this:
And ran like this:
3 thoughts on “Sum of numbers: loops and conditionals”