Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We are passing in a list of numbers. You need to create 2 new lists in your chart, then put all odd numbers in one

We are passing in a list of numbers. You need to create 2 new lists in your chart, then

  • put all odd numbers in one list
  • put all even numbers in the other list
  • output the odd list first, the even list second

Tip:you should use themodulooperator to decide whether the number is odd or even. We provided a function for you to call that does this.

Don't forget to define the 2 new lists before you start adding elements to them.

I need help with this. This is the code I was given:

1 import sys

2 numbers = sys.argv[1].split(',')

3 for i in range(0,len(numbers)):

4 numbers[i]= int(numbers[i])

5

6 def isEven(n) :

7 return ((n % 2) == 0)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Programming questions