Sum of numbers: loops and conditionals

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: 

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:

At the end, my program looked like this:


And ran like this:




3 thoughts on “Sum of numbers: loops and conditionals

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s