How do `+` and `*` build and stretch strings — and why is `"3" * 5` nothing like `3 * 5`?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
You are given first = "Ada" and last = "Lovelace". Build the full name
"Ada Lovelace" — first name, a single space, then last name — and assign it to
full_name. Remember: + inserts no space of its own.
Strings as quoted character sequences
Define a string as a case-sensitive sequence of letters, digits, spaces and symbols enclosed in quotation marks, and record a = "me" and z = "you" as examples.
+ joins exactly, * repeats by an integer
Record that no space is inserted automatically, and evaluate a + b, a + " " + b and a * 3 for a = "me" and b = "myself".
Quoted digits and the int() cast
With f = "a", g = " b" and h = "3", evaluate (f + g) * int(h) to "a ba ba b", and record that (f + g) * h raises a TypeError.
len() as a character count
State that len is an expression evaluating to a single integer, and record len("abc") as 3.