Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add challenge solutions #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

aedwardg
Copy link

@aedwardg aedwardg commented Nov 1, 2020

Changes

Added solutions for the 3 optional challenges at the end of the project:
image
I also included example of how to use a for-loop to solve Challenge 1.
I felt this was important because most Codecademy learners -- even those who know other languages or have completed
the entire Learn Swift course -- would have trouble using a for-loop for Challenge 1 due to the nature of Swift's sets.

Reason

For anyone coming from another language or trying to implement what they learned from previous lessons, it makes sense to try using a for loop in Challenge 1.
However, if you try to do it based on previous examples of for loops in the curriculum, it won't work as expected.

Sets in Swift are value types and cannot be subscripted by their index the way arrays can.
This presents unique issues when trying to loop through a set of sets to perform manipulations on those sets.

I tried explaining this to a user in the Forums here and giving examples here, but quite frankly, this is probably too advanced for many of the learners to understand.

Rather than overwhelm learners when they ask about it on the forums, I think it might just be better to include these examples in the official sample solution. That way, if they get stuck they can see the easier solution as well as an example that uses the for loop.

Added solutions for the 3 optional challenges at the end of the project.

Also included example of how to use a for-loop to solve challenge 1.
I felt this was important because most Codecademy learners -- even
those who know other languages or have completed the entire
Learn Swift course -- would have trouble using a for-loop for
Challenge Codecademy#1 due to the nature of Swift's sets.

 Sets in Swift are value types and cannot be subscripted by their index
 the way arrays can. This presents unique issues when trying to loop
 through a set of sets to perform manipulations on those sets.
@CLAassistant
Copy link

CLAassistant commented Nov 1, 2020

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants