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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started