Lecture

Coding Quiz - Determine Odd/Even

In this quiz, you will write a function using the while loop and lists to determine whether each number in a given list of integers is odd or even. Based on this, the function will return a new list containing the strings "Odd" or "Even".

The solution function iterates over each element in the input list and adds "Odd" if the element is odd or "Even" if the element is even to a new list, and then returns it.

Parameter Format
def solution(numbers): # Write your code here return

Constraints

  • The input list contains only integers.

  • The list is not empty and contains at least one element.


Example

  • Input: [1, 2, 3, 4, 5]

  • Output: ["Odd", "Even", "Odd", "Even", "Odd"]

Lecture

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help