Write a python program that prompts for an integer-lets


PYTHON - PLEASE INCLUDE #COMMENTS ON EACH LINE FOR BETTER UNDERSTANDING

Sum of consecutive integers

Write a Python program that prompts for an integer-let's call it X-and then ands the sum of X consecutive integers starting at 1. That is, if X = 5, you will and the sum of 1 + 2 + 3 + 4 + 5 = 15

Modify your program by enclosing your loop in another loop so that you can ?nd consecutive sums.

For example, if 5 is entered, you will ?nd ?ve sums of consecutive numbers:

1 = 1

1+2 = 3

1+2+3 = 6

1+2+3+4 = 10

1+2+3+4+5 = 15

Print only each sum, not the arithmetic expression.

Modify your program again to only print sums if the sum is divisible by the number of operands.

For example, with the sum 1 + 2 + 3 + 4 + 5 = 15, there are ?ve operands and the sum, 15, is divisible by 5, so that sum will be printed. (Do you notice a pattern?)

1 = 1

1 + 2 + 3 = 6

1 + 2 + 3 + 4 + 5 = 15

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write a python program that prompts for an integer-lets
Reference No:- TGS02906304

Expected delivery within 24 Hours