+ 1

Fill in the blanks to take the numbers from the list while they are even, using the takewhile function. from itertools t

ss

12th Jul 2018, 10:28 AM
Patrick Mita
Patrick Mita - avatar
6 Respuestas
+ 5
from itertools import takewhile nums = [2, 4, 6, 7, 9, 8] a = takewhile(lambda x: x%2==0, nums) print(list(a))
4th Jul 2019, 7:41 PM
Abdullahi Hassan
+ 2
from itertools import takewhile nums = [2,4,8,7,2,3,6] print(list(takewhile(lambda x: x % 2 == 0, nums))) Output: [2,4,8] The list nums contains the numbers that you want. I just put random numbers.
12th Jul 2018, 10:37 AM
Satyam
0
from itertools import takewhile nums = [2, 4, 6, 7, 9, 8] a = takewhile(lambda x: x%2==0, nums) print(list(a))
23rd Jan 2019, 1:39 AM
Sangeetha A
0
Fill in the blanks to take the numbers from the list while they are even, using the takewhile function. from itertools import takewhile nums = [2, 4, 6, 7, 9, 8] a = takewhile ( lambda x: x%2==0, nums) print(list(a))
28th Apr 2020, 7:38 AM
makhan Kumbhkar
makhan Kumbhkar - avatar
0
Fill in the blanks to take the numbers from the list while they are even, using the takewhile function. answer : from itertools import takewhile nums = [2,4,6,7,9,8] a = takewhile(lambda x:x%2==0,nums) print(list(a))
28th May 2021, 5:49 PM
Madhavareddy
Madhavareddy - avatar
0
Answer: from itertools import takewhile nums = [2,4,6,7,9,8] a = takewhile(lambda x:x%2==0,nums) print(list(a))
3rd Dec 2021, 2:28 PM
Thuwayba Ahmed
Thuwayba Ahmed - avatar