Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Python Odd Numbers

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Python Odd Numbers. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

How would you print out all the odd numbers in a list in Python?

Implement print_odd_numbers(nums), where nums is a list of integers. Return a new list containing only the odd values in their original order, so the caller can print the result.

Constraints

  • 0 <= len(nums) <= 10^4
  • -10^9 <= nums[i] <= 10^9
  • All elements of nums are integers

Function Signature

def print_odd_numbers(nums):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output