DEV Community

P Mukila
P Mukila

Posted on

đź§  Understanding the Basics of Programming: 7 Key Concepts Explained Simply

1. 🔤 Variable

Think of a variable as a container that stores information. You can give this container a name and put a value inside it.

name = "Alice"

age = 25

Enter fullscreen mode Exit fullscreen mode

In this example, name is a variable that holds the string "Alice", and age holds the number 25.

👉 Why it matters: Variables help you store and reuse data throughout your code.

2. đź§© Function

A function is a reusable block of code that performs a specific task. Instead of repeating yourself, you can “package” your code into a function.

def greet():
    print("Hello there!")
Enter fullscreen mode Exit fullscreen mode

This function is called greet, and whenever you run it, it prints a greeting.

3. 📞 Function Call

Writing a function is one thing—but to use it, you need to call it.

greet()
Enter fullscreen mode Exit fullscreen mode

That’s how you activate the greet function. Without this line, the function won’t do anything.

4. 📬 Arguments / Parameters

When you want your function to work with specific data, you can pass arguments (also called parameters) to it.

def greet(name):
    print("Hello, " + name)

greet("Alice")
greet("Bob")

Enter fullscreen mode Exit fullscreen mode

Here, name is a parameter, and "Alice" and "Bob" are arguments you pass when calling the function.

5. đź”— Concatenation

Concatenation means joining things together—usually strings (text).

first_name = "John"
last_name = "Doe"
full_name = first_name + " " + last_name
print(full_name)

Enter fullscreen mode Exit fullscreen mode

This prints John Doe. The + sign joins the strings.

6. 🔄 Return

A function can return a value back to the place where it was called.

def add(a, b):
    return a + b

result = add(3, 5)
print(result)  # Outputs: 8

Enter fullscreen mode Exit fullscreen mode

Instead of just printing inside the function, we use return so we can save or use the result later.

7. 🧬 Data Type

Every piece of data in programming has a data type—a classification of what kind of data it is.

Common types:

int: Integer (e.g. 42)

float: Decimal number (e.g. 3.14)

str: String (e.g. "hello")

bool: Boolean (True or False)
Enter fullscreen mode Exit fullscreen mode
name = "Alice"     # str
age = 30           # int
height = 5.5       # float
is_student = True  # bool

Enter fullscreen mode Exit fullscreen mode

👉 Why it matters: Understanding data types helps you avoid errors and use the right tools for the job.

🎯 Final Thoughts

These seven concepts—variables, functions, function calls, arguments/parameters, concatenation, return values, and data types—are the building blocks of programming. Mastering them is your first big step into writing clear, powerful code!

Top comments (0)