Python solution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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)))

8th Jun 2019, 2:41 AM
Praveen E
Praveen E - avatar
4 Answers
+ 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
8th Jun 2019, 3:25 AM
Choe
Choe - avatar
0
Answer is 2
2nd Dec 2020, 2:58 AM
Vikas Mishra
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
6th Dec 2020, 6:42 AM
IRFAN KHAN
IRFAN KHAN - avatar
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
16th Jul 2021, 9:19 AM
Devesh Kumar
Devesh Kumar - avatar