Category: Blog

Your blog category

  • Excel Automation using Python in Tamil | Step by Step openpyxl

    Excel Sheet (marks.xlsx)

    A1 → Name     B1 → Marks     C1 → Result
    A2 → Arun     B2 → 85        C2 → 
    A3 → Kavi     B3 → 40        C3 → 
    
    from openpyxl import load_workbook
    
    wb = load_workbook("marks.xlsx")
    sheet = wb.active
    
    marks = sheet["B2"].value
    
    if marks >= 50:
        sheet["C2"] = "PASS"
    else:
        sheet["C2"] = "FAIL"
    
    wb.save("marks.xlsx")
    
    
    

    Read Column → Update Another Column (Same Sheet)

    for r in range(2, sheet.max_row + 1):
        marks = sheet[f"B{r}"].value
    
        if marks >= 50:
            sheet[f"C{r}"] = "PASS"
        else:
            sheet[f"C{r}"] = "FAIL"
    
    wb.save("marks_updated.xlsx")
    
    

    Read from Sheet1 → Update Sheet2

    Sheet1: Data
    
    Name | Marks
    Arun | 85
    Kavi | 40
    
    Sheet2 : Result
    
    Name | Result
    
    
    data_sheet = wb["Data"]
    result_sheet = wb["Result"]
    
    for r in range(2, data_sheet.max_row + 1):
        name = data_sheet[f"A{r}"].value
        marks = data_sheet[f"B{r}"].value
        if marks >= 50:
            result = "PASS"
        else:
            result = "FAIL"
        result_sheet.append([name, result])
    
    wb.save("result_sheet.xlsx")
    
  • PHP Operators & Expressions | PHP Tutorial in Tamil

    Part 1 – Arithmetic Operators

    • + Addition, – Subtraction, * Multiplication, / Division, % Modulus
    • Example:
    <?php
    $a = 10;
    $b = 3;
    
    echo $a + $b; // 13
    echo $a - $b; // 7
    echo $a * $b; // 30
    echo $a / $b; // 3.3333
    echo $a % $b; // 1
    ?>
    
    

    Part 2 – Assignment Operators

    • *=, +=, -=, =, /=
    • Example:
    <?php
    $x = 5;
    $x += 3; // x = x + 3, result: 8
    $x *= 2; // x = x * 2, result: 16
    ?>
    
    

    Part 3 – Comparison Operators

    • ==, !=, >, <, >=, <=
    • Example:
    <?php
    $a = 10;
    $b = 5;
    
    var_dump($a > $b); // true
    var_dump($a == $b); // false
    var_dump($a != $b); // true
    ?>
    
    

    Part 4 – Logical Operators

    • && AND, || OR, ! NOT
    • Example:
    <?php
    $x = true;
    $y = false;
    
    var_dump($x && $y); // false
    var_dump($x || $y); // true
    var_dump(!$x);      // false
    ?>
    
    

    Part 5 – Expressions & Real-life Example

    • Expressions என்பது Operators மற்றும் Variables பயன்படுத்தி ஒரு result generate செய்யும் statement.
    • Example:
    &lt;?php
    $price = 100;
    $tax = 0.18;
    $total = $price + ($price * $tax);
    echo "Total Price: $total"; // 118
    ?>
    
    
    • Real-life usage: Bill calculation, Age check, Login validation, etc.
  • var_dump() in PHP

    1️⃣ What is var_dump()?

    • var_dump() is a PHP built-in function.
    • It displays detailed information about a variable, including:
      • Data type (string, integer, array, boolean, etc.)
      • Value of the variable
      • Length (for strings or arrays)

    It’s mainly used for debugging during development.


    2️⃣ Syntax

    var_dump($variable);
    
    
    • $variable = any PHP variable you want to inspect.

    3️⃣ Examples

    Example 1 – Integer

    <?php
    $age = 25;
    var_dump($age);
    ?>
    
    

    Output:

    int(25)
    
    
    • int → data type
    • 25 → value

    Example 2 – String

    <?php
    $name = "Saravana";
    var_dump($name);
    ?>
    
    

    Output:

    string(8) "Saravana"
    
    
    • string → data type
    • (8) → number of characters
    • "Saravana" → value

    Example 3 – Boolean

    <?php
    $isActive = true;
    var_dump($isActive);
    ?>
    
    

    Output:

    bool(true)
    
    

    Example 4 – Array

    <?php
    $colors = array("Red","Green","Blue");
    var_dump($colors);
    ?>
    
    

    Output:

    array(3) {
      [0]=> string(3) "Red"
      [1]=> string(5) "Green"
      [2]=> string(4) "Blue"
    }
    
    
    • array(3) → 3 elements
    • Shows index [0], [1], [2], type, and value of each element

    4️⃣ Why use var_dump()?

    1. Debugging variables: Know exactly what type and value a variable has.
    2. Inspect arrays or objects: See nested structures clearly.
    3. Avoid errors: Check before using variables in calculations or functions.

    Tip: You can also use print_r() to display arrays, but var_dump() gives more detailed info, including types.