Question: PYTHON. Write a program which prompts the user to enter a list of integers whose end is indicated by the sentinel -999. Your program is

PYTHON.

Write a program which prompts the user to enter a list of integers whose end is indicated by the sentinel -999.

Your program is supposed to check whether or not the list contains three consecutive integers whose sum is equal to zero.

Examples of such lists are shown below, with the 3 consecutive integers whose sum is zero shown (in bold and italics):

30 10 -21 11 7 -999 30 0 10 -10 7 999 30 0 20 -10 7 -4 2 2 -999

Below are examples of lists not satisfying such a property:

30 10 12 7 999

10 -999

0 -999

-999

Your program is supposed to give a YES/NO answer only.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!