How the answer of this a=[1,2,3,4,5] b=[2,4,5,6] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

How the answer of this a=[1,2,3,4,5] b=[2,4,5,6]

res=a-b print res Answer= [1,3] what about 6 then

30th Apr 2020, 4:10 PM
Manjusha Balasaheb Palve
8 Answers
+ 8
Ok it same like set functions of mathematics ..then
30th Apr 2020, 4:16 PM
Manjusha Balasaheb Palve
+ 5
Thank u so much Alexander
30th Apr 2020, 4:16 PM
Manjusha Balasaheb Palve
+ 4
a-b means all numbers that are in a, but not in b, so ans is [1,3]
30th Apr 2020, 4:12 PM
Alexander Thiem
Alexander Thiem - avatar
+ 3
Yes
2nd May 2020, 1:41 PM
Manjusha Balasaheb Palve
+ 1
I dont know Ruby, but maybe
30th Apr 2020, 4:17 PM
Alexander Thiem
Alexander Thiem - avatar
+ 1
You are welcome
30th Apr 2020, 4:17 PM
Alexander Thiem
Alexander Thiem - avatar
+ 1
bro you just remove the common element of both array and put result remaining element of an array
10th May 2020, 12:04 PM
Asif Qumar
Asif Qumar - avatar
0
This is just like "sets" in mathematics. What elements can you find in a, but not in b. Then you print it out.
2nd May 2020, 8:48 AM
Okeke Ginika
Okeke Ginika - avatar