Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Write a function named count_even_odd that takes in a list as an argument. The list will contain only numbers

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]

Step by Step Solution

3.48 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

Python code def countevenoddlist1 evencount 0 oddcount 0 for num in list1 if num 2 0 evencount 1 els... 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

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions