【Information I】 Computer Science and Programming: The Complete Mastery Guide

Hello! In this chapter, we are going to learn about Computers and Programming.
Many people think, "Programming sounds difficult..." or "Is it impossible if I'm not good at math?" But don't worry!
Programming is like a "Magic Instruction Manual" that tells a computer exactly how to behave. Once you understand the rules, anyone can master it. Let's learn and have fun together!

---

1. How Computers Work (The Five Basic Units)

To understand how a computer functions, let's first look at its "body." A computer is composed of five main roles (units).

The Five Basic Units of a Computer

It's very easy to understand if we compare it to "cooking"!

  • Input Unit: Mouse, keyboard, etc. (Bringing ingredients into the kitchen)
  • Output Unit: Monitor, printer, etc. (Serving the finished meal)
  • Memory Unit: RAM, hard drive, etc. (A recipe book or a cutting board to hold ingredients temporarily)
  • Arithmetic Unit: Where calculations happen (The actual chopping, frying, or stirring)
  • Control Unit: The coordinator (The chef who manages the flow of the entire kitchen)

Point: In modern computers, the Arithmetic Unit and Control Unit are combined and referred to as the CPU (Central Processing Unit). This acts as the computer's "brain."

Trivia: The difference between Memory and Storage
People often confuse "Memory" (RAM) with a "Hard Drive/SSD (Storage)." Think of memory as the "size of your workspace (desk)", and storage as the "size of your filing cabinet." A larger desk (more memory) allows you to handle more tasks at once, making things run much smoother!

---

2. What is an Algorithm?

Before you start programming, the most important concept is the "algorithm."

An algorithm is simply a "set of steps to solve a problem." For example, the steps to make curry or the process of buying tea from a vending machine are both perfect examples of algorithms.

The Three Basic Structures of Algorithms

No matter how complex a program is, it is actually built from a combination of these three structures:

  1. Sequence: Executing steps in order from top to bottom.
  2. Selection (Branching): Splitting based on conditions (If this, then do A. Otherwise, do B).
  3. Repetition (Looping): Repeating the same action (Repeat while this is true).

Point: Drawing a "flowchart" to organize your thoughts is the fastest shortcut to becoming better at programming.

---

3. Basic Programming Knowledge

Now, let's dive into programming. First, let's get comfortable with the terminology.

Variables

A variable is a "labeled box" used to store data.
For example, writing \( x = 10 \) means, "Put the value 10 into the box named x."

Assignment

In math, "=" means "equal to," but in programming, "=" means "put the value on the right into the box on the left."
Example: \( score = score + 10 \)
This means "take the current score, add 10 to it, and put the result back into the score box." This is commonly used to increase points in games.

Data Types

The contents you put into your boxes (variables) have different types.

  • Numeric Type: Numbers like 1, 2, 3. You can perform calculations with these.
  • String Type: Text like 'Hello'. You cannot perform calculations with these.

Common Mistake: The number 10 and the text '10' are different things! Keep in mind that you cannot perform addition on the string '10'.

---

4. Control Structures (If this, repeat that)

This is how you get a program to make "decisions."

Conditional Branching (if statement)

Used for processes like "If the score is 80 or higher, output 'Pass'; otherwise, output 'Fail'."

if (score >= 80):
  print("Pass")
else:
  print("Fail")

Repetition (for loop / while loop)

Used for processes like "repeat 10 times" or "repeat until HP reaches 0." Computers are incredibly good at "repeating the same thing accurately"!

Key Takeaway: Think of programming as a puzzle where you combine "in order," "based on conditions," and "repeating."

---

5. Modeling and Simulation

We learn how to use programming to recreate the real world inside a computer.

Modeling

This is the process of extracting only the necessary parts from a complex real-world system.
Example: A subway map. Actual train tracks are winding and curved, but what passengers need to know is just the "order of stations" and "where to transfer," so they are drawn as straight lines. This is modeling.

Simulation

Using the model you created to predict what will happen in the future.
Examples:

  • Weather forecasting (simulating cloud movements)
  • Predicting the spread of infectious diseases
  • Planning evacuation drills

It might feel difficult at first, but just think of it as "playing with experiments inside a computer" and you'll be fine!

---

Summary: Learning Points

Great work! Let's review the key points from this session.

Checklist:
  • Can you name and explain the roles of the Five Basic Units (Input, Output, Memory, Arithmetic, Control)?
  • Do you understand the three basics of algorithms (Sequence, Selection, Repetition)?
  • Can you visualize a variable as a "box that holds data"?
  • Do you understand that modeling means "extracting only the necessary information"?

The fastest way to learn programming is to get your hands dirty and make mistakes (errors). Try to stay positive and think, "Finding an error is a lucky chance to practice debugging!" I'm rooting for you!