Lessons
Introduction to Programming
3. Problem SolvingBy writing code, you can instruct computers to solve problems – both simple and complex – much faster than a human can!
An example could be that you wanted to know how often a specific word appears in a book. If you wanted to do this yourself, you could read the book from start to finish and draw a line each time the given word appears. For humans, this would be a very slow process, and there is a high chance of error along the way. A computer, on the other hand, can do this in a split second – here, for example, are the number of times each of these 10 names appear in the Lord of the Rings trilogy:
Name | Amount |
---|---|
Frodo | 1747 |
Gandalf | 1168 |
Sam | 1118 |
Aragorn | 677 |
Gollum | 456 |
Gimli | 364 |
Legolas | 321 |
Boromir | 241 |
Sauron | 119 |
Arwen | 17 |
Computers are therefore good at executing many instructions very quickly - but, given our book example, if instead you wanted to know who was the author of the book, then the computer would not be able to give the answer without first instructing it by writing additional code. In this way, computers are fantastically good at following instructions, but not so good at coming up with a solution themselves.
Of course, this was just a small example of how computers can be programmed to solve problems, but with larger amounts of code, it is possible to build huge IT systems that can help cover all sorts of needs – e.g. navigating a single person from A to B, or managing the payment of taxes for an entire nation’s population.