Question: In python 3.0 Write a code for function main that does the following: Creating a variable and initializes it to 0. Uses a while loop

In python 3.0

Write a code for function main that does the following:

Creating a variable and initializes it to 0.

Uses a while loop which runs as long as the variable of the previous step is not equal to -2

Inside the while loop, get two integer number a1, and b2 from the user and

If passing a1,b2 in the order to the function of -2, then add the value to a running sum.

Think about what is need to a running sum. Make sure not call the function twice and to save its result in a variable and hen test the variable.

Otherwise if the return value of the previous step is -2 , make the loop stop without using break.

After the loop stops, print the running sum of all the values.

Initialize all variables as needed

Call main at the end

Make sure to use conversion or casting functions as needed.

note: Run it and show output. Do not copy and paste

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!