-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
arthurwrls
committed
Oct 17, 2022
1 parent
fb06c10
commit f553bd4
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Codecademy.playground/Pages/Test_1.xcplaygroundpage/Contents.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var spanish101: Set = ["Angela", "Declan", "Aldany", "Alex", "Sonny", "Alif", "Skyla"] | ||
var german101: Set = ["Angela", "Alex", "Declan", "Kenny", "Cynara", "Adam"] | ||
var advancedCalculus: Set = ["Cynara", "Gabby", "Angela", "Samantha", "Ana", "Aldany", "Galina", "Jasmine"] | ||
var artHistory: Set = ["Samantha", "Vanessa", "Aldrian", "Cynara", "Kenny", "Declan", "Skyla"] | ||
var englishLiterature: Set = ["Gabby", "Jasmine", "Alex", "Alif", "Aldrian", "Adam", "Angela"] | ||
var computerScience: Set = ["Galina", "Kenny", "Sonny", "Alex", "Skyla"] | ||
|
||
|
||
|
||
var allStudents = spanish101.union(german101) | ||
allStudents = advancedCalculus.union(artHistory) | ||
allStudents = artHistory.union(englishLiterature) | ||
allStudents = computerScience.union(allStudents) | ||
|
||
for item in allStudents { | ||
print(item) | ||
} | ||
|
||
print("Students quantity: \(allStudents.count)") | ||
|
||
var noLanguage = allStudents.subtracting(german101) | ||
noLanguage = noLanguage.subtracting(spanish101) | ||
print("Students not taken any language: \(noLanguage)") | ||
|
||
var spanishOrGerman = spanish101.symmetricDifference(german101) | ||
print("Student taken only one language: \(spanishOrGerman)") | ||
|
||
var languageAwardWinners = spanish101.intersection(german101) | ||
languageAwardWinners = languageAwardWinners.intersection(englishLiterature) | ||
print("Students taken all languages and English literature: \(languageAwardWinners)") | ||
|
||
var sevenPlus = 0 | ||
var classSet: Set = [spanish101, german101, advancedCalculus, artHistory, englishLiterature, computerScience] | ||
|
||
for item in classSet { | ||
if item.count >= 7 { | ||
sevenPlus += 1 | ||
} | ||
} | ||
|
||
print("Classes with 7+ students: \(sevenPlus) classes") |
Binary file modified
BIN
+61.9 KB
(190%)
...d/playground.xcworkspace/xcuserdata/arthurwrls.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.