developing a Python program to process a set of integers, using functions, including a main function....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
developing a Python program to process a set of integers, using functions, including a main function. The main function will be set up to take care of the following bulleted items inside a loop: • The integers are entered by the user at the keyboard, one integer at a time • Make a call to a function that checks if the current integer is positive or negative Make a call to another function that checks if the current integer to see if it's divisible by 2 or not • The above steps are to be repeated, and once an integer equal to 0 is entered, then exit the loop and report each of the counts and sums, one per line, and each along with an appropriate message NOTE 1: Determining whether the number is positive or negative will be done within a function; and then a call to that function will be made from within the main function. The following is what you are to do within that function: if an integer is positive, add that integer to the Positive sum increment the Positive_count by one o If the integer is negative add that integer to the Negative_sum increment the Negative_count by one O NOTE 2: Determining whether the number is divisible by 2 or not will be done within a second function; and then a call to that function will be made from within the main function. The following is what you are to do within that function: o if the integer is divisible by 2 increment the Divby2_count by one o if the integer is not divisible by 2 increment the Not Divby2_count by on NOTE 3: It's your responsibility to decide how to set up the bold-faced items under NOTE 1 and NOTE 2. That is, you will decide to set them up as function arguments, or as global variables, etc. What to submit: Your Python solution as a text file A screenshot of a run of your program, showing the output A sample program run is attached below. Bb Welcome, Homer - Blackboard L X C onlinegdb.com/online_python_compiler OnlineGDB beta online compiler and debugger for c/c++ code. compile. run. debug. share. IDE My Projects Classroom new Learn Programming Programming Questions Sign Up Login fy+11.9K GOT AN OPINION? SHARE AND GET REWARDED. ORakuten AIP Have fun taking surveys and get paid! ADS VIA CARBON Bb Edit Assignment: Lab FOUR-202 X G online python compiler - Google X Online Python Compiler - online X + About FAQ Blog Terms of Use • Contact Us • GDB Tutorial • Credits • Privacy © 2016-2020 GDB Online Type here to search SPONSOR Microsoft - Build and develop apps with Azure. Free until you say otherwise. ▶ Run Debug Stop Share H Save {} Beautify ± main.pv Enter a non-zero integer: 98 Enter another non-zero integer: 23 Enter another non-zero integer: -170 Enter another non-zero integer: 9882 Enter another non-zero integer: 29 Enter another non-zero integer: -33 Enter another non-zero integer: 54 Enter another non-zero integer: 0 5 positive integers were entered. Sum of those positive integers is 10086 2 negative integers were entered. Sum of those negative integers is -203 4 integers were divisible by 2. 3 integers were not divisible by 2. .. Program finished with exit code 0 Press ENTER to exit console. 300 input 0 X ☆ H Paused: Language Python 30 5:16 PM 7/11/2020 developing a Python program to process a set of integers, using functions, including a main function. The main function will be set up to take care of the following bulleted items inside a loop: • The integers are entered by the user at the keyboard, one integer at a time • Make a call to a function that checks if the current integer is positive or negative Make a call to another function that checks if the current integer to see if it's divisible by 2 or not • The above steps are to be repeated, and once an integer equal to 0 is entered, then exit the loop and report each of the counts and sums, one per line, and each along with an appropriate message NOTE 1: Determining whether the number is positive or negative will be done within a function; and then a call to that function will be made from within the main function. The following is what you are to do within that function: if an integer is positive, add that integer to the Positive sum increment the Positive_count by one o If the integer is negative add that integer to the Negative_sum increment the Negative_count by one O NOTE 2: Determining whether the number is divisible by 2 or not will be done within a second function; and then a call to that function will be made from within the main function. The following is what you are to do within that function: o if the integer is divisible by 2 increment the Divby2_count by one o if the integer is not divisible by 2 increment the Not Divby2_count by on NOTE 3: It's your responsibility to decide how to set up the bold-faced items under NOTE 1 and NOTE 2. That is, you will decide to set them up as function arguments, or as global variables, etc. What to submit: Your Python solution as a text file A screenshot of a run of your program, showing the output A sample program run is attached below. Bb Welcome, Homer - Blackboard L X C onlinegdb.com/online_python_compiler OnlineGDB beta online compiler and debugger for c/c++ code. compile. run. debug. share. IDE My Projects Classroom new Learn Programming Programming Questions Sign Up Login fy+11.9K GOT AN OPINION? SHARE AND GET REWARDED. ORakuten AIP Have fun taking surveys and get paid! ADS VIA CARBON Bb Edit Assignment: Lab FOUR-202 X G online python compiler - Google X Online Python Compiler - online X + About FAQ Blog Terms of Use • Contact Us • GDB Tutorial • Credits • Privacy © 2016-2020 GDB Online Type here to search SPONSOR Microsoft - Build and develop apps with Azure. Free until you say otherwise. ▶ Run Debug Stop Share H Save {} Beautify ± main.pv Enter a non-zero integer: 98 Enter another non-zero integer: 23 Enter another non-zero integer: -170 Enter another non-zero integer: 9882 Enter another non-zero integer: 29 Enter another non-zero integer: -33 Enter another non-zero integer: 54 Enter another non-zero integer: 0 5 positive integers were entered. Sum of those positive integers is 10086 2 negative integers were entered. Sum of those negative integers is -203 4 integers were divisible by 2. 3 integers were not divisible by 2. .. Program finished with exit code 0 Press ENTER to exit console. 300 input 0 X ☆ H Paused: Language Python 30 5:16 PM 7/11/2020
Expert Answer:
Related Book For
International Business
ISBN: 9781292274157
8th Edition
Authors: Simon Collinson, Rajneesh Narula, Alan M. Rugman
Posted Date:
Students also viewed these programming questions
-
Name one advantage of fiber optic devices for biomedical instrumentation.
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Malika charges $6.20 per hour for babysitting. She babysits 6 hours each week. She spends $15 per week and puts the rest of her earnings in a savings account. After 12 weeks, Malika's grandparents...
-
Which of the following is true about a statement of cash flows? The statement of cash flows is prepared at the option of management. The statement of cash flows is required by generally-accepted...
-
Bonavista Outdoors Store sells on account. When a customer account becomes three months old, Bonavista Outdoors Store converts the account to a note receivable and immediately discounts the note to a...
-
What are the two options that many businesses have? Why does a traditional NPV analysis tend to underestimate the value of an investment opportunity? Explain.
-
The Jets Company recorded a deferred tax liability in the amount of \(\$ 18,750\) in December 2020, due to the book value of equipment exceeding the tax basis of equipment by \(\$ 75,000\). The...
-
Rocket Company produces small gasoline-powered engines for model airplanes. Mr. Clemens, Rockets CFO, has presented you with the following cost information: Direct Materials Inventory, beginning.......
-
The questions are in the photos below:. Question 7 Not yet answered Marked out of1 F Flag question Question 8 Not yet answered Marked out of1 F Flag question What is the undiscounted cash flow in the...
-
On January 1, Year 4, Handy Company (Handy) purchased 70% of the outstanding common shares of Dandy Limited (Dandy) for $13,300. On that date, Dandy's shareholders' equity consisted of common shares...
-
Two formulas that approximate the dosage of a drug prescribed for children are DA A + 12 Young's Rule: C=- Cowling's Rule: C = and D(A + 1) 24 where A is the child's age in years, D is the adult...
-
Explain how this law impacts a police officers responsibilities? PURPOSE To provide a central repository of criminal intelligence received from prisoners and improve communications and sharing of...
-
Harley is a six month old baby who attends little ly. His mother Lindsey usually picks him up at the end of each day. Occasionally Harleys father Jason picks him up. Harleys mum has a high pressure...
-
Water is moving at a velocity of 3 . 0 0 m / s through a hose with an internal diameter of 1 . 2 0 cm . What is the volume flow rate in liters per minute? ( 1 m 3 = 1 0 0 0 Liter, 1 min = 6 0 s )
-
Good Care Hospital is considering a project that is expected to reduce the hospital's annual operating costs by $250,000 in Year 1. In addition, the project is expected to generate $450,000 in...
-
Respond to the following with why/why not you agree or disagree with the below statement. There is a lot of damage that an individual can do with just a computer and an internet connection. In...
-
A company has $5 million of financing available. This can be used to fund either project X or Y but not both. Projects X and Y are examples of O normal and non-normal cash flow projects, respectively...
-
Beginning with a country that has a trade deficit, demonstrate graphically what will happen to a countrys potential output with globalization if that countrys costs of production fall. Explain your...
-
China has become increasingly dominant in international trade over the last 30 years and is revered as the flagship emerging economy. Much of this growth has been based on inward FDI and over the...
-
3M is a major MNE with over 55,000 products sold in 200 countries, comprising everything from office supplies to construction and building maintenance to chemicals. In 2017, it employed over 90,000...
-
How have emerging economies liberalised to encourage FDI?
-
Correctly apply the order of operations to compute the following: \(4-25 \times 6 / 10 \times 3^{2}+7 \times 2^{3}\).
-
Calculate \(4 \times 8^{3}\).
-
Calculate \(2+3^{2} \times 4\).
Study smarter with the SolutionInn App