Online · Kobe · Japan

Computational Thinking Logic Classes for Expat Kids in Kobe

Computational thinking logic classes for expat kids in Kobe teach pattern recognition, decomposition and algorithmic design through puzzles, Scratch challenges and mentor feedback—in English.

Computational thinking Kobe

Video coming soon

Lesson notes and Q&A below are available now. The video will appear here when published.

1. Introduction: What Is a Function?

In earlier topics, loops were introduced as a way to repeat a task multiple times automatically. In software development, functions represent another fundamental and frequently used concept.

A function is a reusable, self-contained block or lines of code designed to perform a specific task. When you write, debug, and refine a high-quality piece of code, you do not want to rewrite it every time that logic is needed. Instead, you preserve and store that code block inside a function. Once stored, you can call and execute that function from any part of your program or across different programs.

2. Why Functions Are Good Programming Practice

Dividing your codebase into modular functions provides major structural advantages:

  • Code Reusability — Write once, call anywhere. Instead of manually copying and pasting identical lines of code, you write, test, and debug the logic once. Wrapping it in a function allows you to reuse it repeatedly without redundant coding.
  • Program Organization & Maintainability — Consider a program with 2,000 continuous lines of code. Reading such a program linearly is difficult. If you divide those 2,000 lines into distinct, modular functions (for example, 10 focused functions) and give each a descriptive name, the entire program becomes organized and clear.
  • Easy Debugging — Test and refine isolated logic without scanning the whole script.
  • Future Portability — Well-designed functions can easily be transferred and integrated into future programs without re-engineering the logic from scratch.

3. Function Definition vs. Function Execution (Calling)

A fundamental rule when working with functions is the distinction between defining a function and calling it:

  • Function Definition: When you define a function, you are merely providing a template or blueprint for the instructions. At the time of definition, the function does not run or execute.
  • Function Call: A function executes only when you explicitly call it by name.
  • Define Once, Call Many: A function is defined only once in your program, but it can be called and executed hundreds or thousands of times whenever needed.

4. Python Function Syntax: The def Keyword

To create a function in Python, follow these syntax rules:

  1. The def keyword tells the Python interpreter that you are about to define a new function.
  2. Use a descriptive name that clearly describes what the function does.
  3. Parentheses () follow the name (they can hold parameters), followed by a colon : to start the function body.
  4. The lines of code that perform the task must be indented beneath the def statement.

5. Code Walkthroughs & Examples

Example 1: Defining and Calling a Basic Greeting Function

This example packages a greeting message inside a function:

# 1. Defining the function (the template)
def greet():
    print("Hello, World!")

# 2. Calling the function to execute it
greet()

# 3. Calling the function a second time
greet()

Execution Walkthrough

  • Writing the first two lines creates and stores the greet function template, but nothing prints to the screen yet.
  • When the script calls greet(), Python enters the function body and prints Hello, World!.
  • Calling greet() again runs the block a second time.

Output:

Hello, World!
Hello, World!

Example 2: Making Functions Dynamic with Parameters

Functions become significantly more versatile when you pass values into them. This allows the same function logic to process different data each time it is called:

# 1. Defining a function with a parameter variable 'name'
def greet(name):
    print("Hello", name)

# 2. Calling the function with different input values
greet("Ali")
greet("Sara")

Execution Walkthrough

  • The parameter name is placed inside the parentheses to receive incoming values.
  • When greet("Ali") is called, the string "Ali" is assigned to name, producing Hello Ali.
  • When greet("Sara") is called, "Sara" is passed into name, producing Hello Sara.

Output:

Hello Ali
Hello Sara

Lesson Q&A

A function is a reusable, self-contained block of code designed to perform a specific task. Using functions is considered good programming practice because it promotes code reusability—allowing you to write, test, and debug code once and call it multiple times without duplicating lines. It also drastically improves program organization; instead of reading a confusing 2,000-line script from top to bottom, functions break the codebase into modular, descriptively named components that are easy to understand, debug, and reuse in future projects.

No, a function does not execute when it is defined. Defining a function (using the def keyword) merely provides a template or blueprint that Python stores in memory. The function executes only when it is explicitly called by its name followed by parentheses (e.g., greet()). While a function is defined only once, it can be called and executed hundreds or thousands of times throughout a program.

Parameters allow functions to receive dynamic inputs rather than producing fixed, static outputs. By placing a variable name inside the function's definition parentheses (such as def greet(name):), the function can accept different data values each time it is executed. For instance, calling greet("Ali") outputs Hello Ali, while calling greet("Sara") outputs Hello Sara, allowing the same core logic to process diverse inputs dynamically.

What children can learn

WhatsApp +92 322 421 7059

AI and Robotics Club | The 100 Mission AI & Robotics Hero Journey

Recommended self-paced course for parents & educators

Maths for Future Coders on Udemy.

Disclosure: This page contains affiliate links. We may earn from qualifying purchases at no extra cost to you. Links are intended for parents and educators, not as marketing directed at young children.

Decompose, Pattern, Algorithm: Logic Training for Kobe Expat Families

Kobe expat families benefit from transferable logic skills—not only coding syntax. Enquire WhatsApp +92 322 4217059. No fabricated Kobe campus.

Frequently asked questions

What is computational thinking, and why is it important for expat kids in Kobe?

Computational thinking is a problem-solving framework based on decomposition, pattern recognition, abstraction, and algorithmic design. It empowers students in Kobe to approach complex math, science, and coding challenges logically.

How are these logic classes conducted online for international families in Kobe?

Lessons feature interactive logic puzzles, algorithmic games, Scratch code challenges, and real-time mentor code reviews in small, engaging online groups conducted in English.

Where can expat parents in Kobe view class schedules and book a free trial?

Message our admissions team on WhatsApp to receive our current JST weekend timetable and claim a free trial session pass.

Explore related learning

MeguroPython · Meguro ShibuyaScratch · Shibuya OsakaBootcamp · Osaka