Write a function named count_even_odd that takes in a list as an argument. The list will...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function named count_even_odd that takes in a list as an argument. The list will contain only numbers in it. Return a list with two elements in it, the number of even numbers and the number of odd numbers. The number of even numbers must be first. Examples: count_even_odd ([2, 3, 4, 5, 6]) returns [3, 2] count_even_odd ([43, 12, .0, 372, 1, -5]) returns [3, 3] count_even_odd ([3) returns [0, 0] Write a function named count_even_odd that takes in a list as an argument. The list will contain only numbers in it. Return a list with two elements in it, the number of even numbers and the number of odd numbers. The number of even numbers must be first. Examples: count_even_odd ([2, 3, 4, 5, 6]) returns [3, 2] count_even_odd ([43, 12, .0, 372, 1, -5]) returns [3, 3] count_even_odd ([3) returns [0, 0]
Expert Answer:
Answer rating: 100% (QA)
Python code def countevenoddlist1 evencount 0 oddcount 0 for num in list1 if num 2 0 evencount 1 els... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
The diameter of a cylinder is measured using a Vernier callipers with no zero error. It is found that the zero of the Vernier scale lies between 5.10 cm and 5.15 cm of the main scale. The Vernier...
-
Compute the bandwidth of the following matrix: A= 635 00 0 1 0 0 2 4 2 1 1 0 1 2 3 0 0 1 0 0 0 000042 0 0 0 0 2 1
-
For Problems 1-3. rewrite each vector system as a system of first-order DEs. 1. 2. 3. 2 x= 1 0 0 0 -1 0 , = 0 3 1
-
Pinduoduo plans to launch a new platform to compete with its competitors, JD.Com, Taobao, and Tmall. The product manager of the new platform should decide whether to leverage the social commerce...
-
LIBOR zero rates are flat at 5% in the U.S and flat at 10% in Australia (both annually compounded). In a four-year diff swap Australian LIBOR is received and 9% is paid with both being applied to a...
-
1. How do information technologies contribute to the business success of the companies depicted in the case? Provide an example from each company explaining how the technology implemented led to...
-
If the initial extra cost of a solar system is \(\$ 5,000\), what are the annual payments of a self-amortization loan if the interest rate is \(12 \%\), the inflation rate is \(4 \%\), and the...
-
Inventoriable CostsPerpetual Bradford Machine Company maintains a general ledger account for each class of inventory, debiting such accounts for increases during the period and crediting them for...
-
1. Different types of groups 2. Define small group communication 3. Why do we join groups? 4. Are you a member of any professional or social groups? Why did you join the group? 5. What would you...
-
Which of the following is a positive reason for learning chemistry? (a) Chemistry is relevant to daily life (b) Chemistry offers career opportunities (c) Chemistry studies interesting topics (d)...
-
Presented below is information related to Marigold Company. Date Ending Inventory (End-of-Year Prices) Price Index December 31, 2017 $ 77,100 100 December 31, 2018 140,238 126 December 31, 2019...
-
Identify the strengths and weaknesses of the UML notation.
-
How UML helps in RUP in developing software product using object oriented methods? Explain.
-
What artifacts may start in elaboration?
-
Which object oriented diagrams are generated during transition phase?
-
What are the key ideas and best practices that manifest in elaboration?
-
P, Q and R entered into a partnership with their initial capital in the ratio of 6: 5: 8 respectively. After four months P withdrew 1/3rd of his initial capital and Q withdraw 1/5th of his initial...
-
Consider the function f and its graph. a. Estimate the zeros of the area function b. Estimate the points (if any) at which A has a local maximum or minimum. c. Sketch a graph of A, for 0 x 10,...
-
Your application wont actually function as a calculator at this point. You are just designing the interface.
-
Modify the Student class in Listing 8.2 so that it implements the comparable interface. Define the compareTo method to order Student objects based on the value in studentNumber. In a main method...
-
Suppose that we are working for an online service that provides a bulletin board for its users. We would like to give our users the option of filtering out profanity. Suppose that we consider the...
-
The steel rod having a diameter of 1 in. is subjected to an internal moment of M = 300lbft. Determine the stress created at points A and B. Also, sketch a three-dimensional view of the stress...
-
The steel beam has the cross-sectional area shown. If w=5 kip/ft, determine the absolute maximum bending stress in the beam. W 8 8 ft- 8 ft W ft- -8 ft- .8 in. 0.30 in. 0.3 in.- 10 in. 0.30 in.
-
The steel beam has the cross sectional area shown. Determine the largest intensity of distributed load w that it can support so that the bending stress does not exceed max = 22 ksi. 8 ft- 8 ft W -8...
Study smarter with the SolutionInn App