🔤 Strings & Booleans
Strings & Booleans: Think of a string as a necklace strung with beads — each bead (character) sits in order and can be called by its number (index).
Think of a string as a necklace strung with beads — each bead (character) sits in order and can be called by its number (index). Now ask: why does "string1 + string2" glue them together but "string1 - string2" throws an error? Because "+" means lining beads up one after another (that makes sense), but "subtracting" from a necklace is undefined — which bead, from where? In Java, String is immutable — "modifying" a String actually creates a brand NEW String, while the old one sits in memory. Python works the same way: writing s += "x" doesn't change s itself — Python builds a new string and moves the label onto it. In QA, this is exactly why concatenating strings inside a loop quietly creates thousands of hidden copies and slows things down.
Java uses String.charAt(), substring(), indexOf(). Python has shorter, more readable syntax: s[0], s[1:5], "hello" in s.
Micro Lab: Python coding practice
Replace the TODO line with the critical line from the expected solution. This is not a real runtime; the goal is to reinforce writing the correct structure in a controlled way.
Step by Step: Python coding practice
Read inputs and data types
Complete the critical line with the smallest change
Run the code and compare expected output
If it fails, read traceback or assertion message
Make the result reusable for a test report
What is the safe order for running Python QA code?
Java vs Python — Strings
What does "Hello"[::-1] return?
[::-1] reverses the string. Step -1 means go backwards. This is a very Pythonic trick with no Java equivalent.