only_evens ( [1, 2, 3]) >>> [2] only_evens([1, 5, 3]) [] only_evens ( [4, 4, 4]) [4, 4, 4] >>> >>>

New Perspectives on HTML5, CSS3, and JavaScript
6th Edition
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Patrick M. Carey
Chapter14: Exploring Object-based Programming: Designing An Online Poker
Section14.1: Visual Overview: Custom Objects, Properties, And Methods
Problem 7QC
icon
Related questions
Question

in python

create function that returns even numbers in a list form 

must only use while loop and if built-in

cannot use anything else such as split, splice, sort!

cannot use for in statements!

must return a list!

>>> only_evens([1, 2, 3])
[2]
>>> only_evens([1, 5, 3])
[]
>>> only_evens ( [4, 4, 4])
[4, 4, 4]
Transcribed Image Text:>>> only_evens([1, 2, 3]) [2] >>> only_evens([1, 5, 3]) [] >>> only_evens ( [4, 4, 4]) [4, 4, 4]
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning