0
Python solution
can anybody explain this code`s output : nums = {1, 2, 3, 4, 5, 6} nums = {0, 1, 2, 3} & nums nums = filter(lambda x: x > 1, nums) print(len(list(nums)))
4 Réponses
+ 3
nums = {1, 2, 3, 4, 5, 6} #set
nums = {0, 1, 2, 3} & nums #finds items in both sets which are 1, 2, 3
nums = filter(lambda x: x > 1, nums) #2, 3
print(len(list(nums))) #result of filter is put into list to find length which is 2
0
Answer is 2
0
What is the result of this code?
nums = {1, 2, 3, 4, 5, 6}
nums = {0, 1, 2, 3} & nums
nums = filter(lambda x: x > 1, nums)
print(len(list(nums)))
Ans:2
0
What is the result of this code?
nums = {1, 2, 3, 4, 5, 6}
nums = {0, 1, 2, 3} & nums
nums = filter(lambda x: x > 1, nums)
print(len(list(nums)))
Answer is 2