Results for “index”

5 results

  1. Article Mini projects

    Medical dispenser - Don’t trust the user

    …'w') as f: json.dump(self.event_log, f, indent=2) def _create_event(self, event_type, success, reason=""): """Create a tamper-evident event record with proper HMAC""" # Use UTC time for persistence…

  2. Article Python Fundamentals

    Python Functions for Beginners

    …most common syntax error in this whole topic. Everything indented under the def line is the body of the function. Python uses that indentation (four spaces is the convention) to work out where the…

  3. Article Python Fundamentals

    Python If/Else for Beginners

    …orbit insertion burn.") If fuel_percent > 50 is True , the indented block runs. If it's False , Python skips the block entirely. else — the fallback plan Use else to run code when the if condition is…

  4. Article Python Fundamentals

    Nested Loops in Python

    …results. Always use different names. Mistake 2: Wrong Indentation # Where should this print go? for y in range(3): for x in range(3): print(f"({x}, {y})", end=" ") print() # ← This executes after each…

  5. Article Python Fundamentals

    A Practical Guide to Getting Started with Programming

    …for typos (Python is very picky about spelling) Check indentations Make sure all quotes and parentheses come in pairs Add print statements to see what's happening: # If your calculation is wrong…