Question: This is a python code and I want to covert it from for loop into while loop. can anyone help me with that, please from

This is a python code and I want to covert it from for loop into while loop. can anyone help me with that, please

from typing import List

def only_evens(lst: List[List[int]]) -> List[List[int]]:

"""Return a list of the lists in lst that contain only even integers.

>>> only_evens([[1, 2, 4], [4, 0, 6], [22, 4, 3], [2]])

[[4, 0, 6], [2]]

"""

even_lists = []

for sublist in lst:

iseven=True

for element in sublist:

if element%2!=0:

iseven=False

if iseven==True:

even_lists.append(sublist)

return even_lists

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!