7 Days Swift Challenge - Day 2: If Else Statement and Control Flow in Swift - How to Make an App
Today we have two sessions so I hope you will arrange the time to make it happen! Let's dive right in!
Your Code Challenge:
The magic of modern platforms nowadays whether it's a social media platform, Netflix to watch movies, Spotify or Apple Music to listen to music, Amazon to buy things is they suggest us things that we might be interested in that we didn't even consciously aware of!
This really is not magic. It is engineered by a discipline in Computer Science called Machine Learning.
What is Machine Learning?
A major difference between a computer and humans is we humans can learn from past experiences. So the question is, "Can we teach (code) the computer in a way that it can learn from past experiences?"
The answer is yes. That is machine learning -- a way we program computers to learn from past experiences -- which is data!
For example, if we are Apple's App Store, looking at our users' download history, we know what if a person is less than 20 years of age, the person will very much likely want to download Snapchat so we recommend the app to the user. If a user is from 20 to 35 years of age and female, she might like Whatsapp. If a user is from 20 to 35 years of age and male, he might like Instagram. So we recommend those apps to them.
So let's get into today's Code Challenge.
We will make a simple movie suggestion program. We will need to look at certain movies users watched in the past and suggest new movies.
Create an array called movies list containing these movies: The Last Man on The Moon, The Avengers, Captain America, Spider Man Homecoming. What is the type of this array?
Next, create an array called suggestion list. Initialize it to be an empty array of String.
Now if the movies list array contains The Last Man on the Moon, we will suggest another movie called The Martian by appending the movie to our suggestion list because he might like space exploration movies.
If the user watched Spider Man Homecoming, we will suggest Iron Man because they might like hero type of movie -- which btw is my favorite 🤓
If users watched Game of Thrones, we will suggest Sherlock Holmes to them. I never watched GoT but it might fit 😅
Finally, share you Code Challenge solution in the comment section with me below!
Have fun, my friends!
Get this swift course: https://www.ductran.co/
For more videos: https://www.youtube.com/channel/UCvPFGq6luCqAVGiFpzTvkIA/videos