Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions