+ 1

How do I do this???

Drag and drop from the options below to create a new set "c", with only the values common to both "a" and "b", if not all of the values of set "a" are contained in set "b". let a: Set = [1, 2, 3] let b: Set = [3, 5, 2] if ! a. b) { let c: = a.(b) } isSuperset(of: I sSubset(of: intersection union Set subtracting I need helpppppppppppppp

8th Sep 2020, 3:47 PM
TheJTwin
TheJTwin - avatar
2 Antworten
+ 1
Generally Union of 2 sets results to combining set of a and b with all values. So yours =>[1,2,3,5] Intersection of a and b sets results to values common to a and b sets.. So =>[2,3] Substraction a-b sets gives the values from a which are not in h so [1].
9th Sep 2020, 4:32 PM
Jayakrishna 🇮🇳
+ 1
I give an example of Swift 4 code: var set1: Set = [1, 2, 3, 4, 5, 6] var set2: Set = [5, 6, 7, 8, 9, 0] var set3: Set = [7,9] print("1",set2.isSubset(of: set2)) print("2",set2.isStrictSubset(of: set2)) print("3",set3==set2) print("4",set2.isSuperset(of: set3)) print("5",set2.isStrictSuperset(of: set3)) print("6",set2.isDisjoint(with: set3)) print("7",set1.isDisjoint(with: set3)) /* print 1 true 2 false 3 false 4 true 5 true 6 false 7 true */ This should clear all your doubts... 😀😀😀
10th Sep 2020, 4:53 PM
🔥 Destiny 🔥