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...
-
As follower AB rolls along the surface of member C, it exerts a constant force F perpendicular to the surface. (a) Replace F with an equivalent force-couple system at the point D. (b) For b = 1 ft...
-
Which of the following is the definition of the term niche? A. All the environmental factors that determine where an organism lives B. All the food webs in an ecosystem C. The place where an organism...
-
The Corporate Winner and People's Choice Winner was Daniel Gallagher from NASA's Scientific Visualization Studio, for his video "Martian Atmosphere Loss Explained by NASA." Watch this video and...
-
1. What effect does the outcome of this case have on Redmonds ability to earn a living? Should PepsiCo have to re-hire him? 2. Suppose Redmond had been terminated by PepsiCo before he was hired by...
-
Use the Following metrics to perform the operation, if possible. A = F2-12 1 3 0 1 2 3 B 1 1 2 3 5 3-3 L0323 Find 2A-3B
-
Knockoffs Unlimited, a nationwide distributor of low-cost imitation designer necklaces, has an exclusive franchise on the distribution of the necklaces, and sales have grown so rapidly over the past...
-
Leadership Case Study Drives for work and Development Sally and David MTCR is a leading company in the development and manufacturingof a broad range of custom hardware solutions. The company...
-
How are direct marketing methods different from traditional advertising methods?
-
Define and explain the difference between advertising and promotion.
-
What makes the Internet interactive?
-
What are the strategic uses of out-of- home and transit advertising in an IMC campaign?
-
Internet marketing adds another dimension to advertising efforts. What is it?
-
The above table illustrates the unit labor requirements in hours for cars and hats for Laos and France. Assume, as we did in class, that only labor matters in production, and that only demand drives...
-
Reconsider Prob. 1474. In order to drain the tank faster, a pump is installed near the tank exit as in Fig. P1475. Determine how much pump power input is necessary to establish an average water...
-
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?
-
What is the relation between degrees Fahrenheit and degrees Rankine? And the relation between degrees Celsius and Kelvin?
-
State Newton's second law as you would apply it to a control mass.
-
Define a 1-pound force in terms of the acceleration it will give to a 1-pound mass. Give a similar definition for a newton in the SI system.
Study smarter with the SolutionInn App