A string is text inside quotes. Strings have methods, which you call with a dot: .strip() removes spaces at both ends, .lower(), .upper() and .title() change capitals, .replace("-", " ") swaps text, and .split(",") cuts a string into a list.
Strings can't be changed in place. A method returns a new string, so store the result: name = name.strip().
Square brackets pick characters by position, counting from 0: code[0] is the first, code[-1] the last, and code[0:4] the first four (a slice stops before its end position).
An f-string puts values inside text. Write f before the quote and each value in braces: f"{name} owes {amount}". After a colon you can format the value: {amount:,.2f} adds thousands separators and two decimals, and {rate:.1%} shows 0.073 as 7.3%.