Code example. callsign length = len(callsign) print(callsign length) Lesson 3. Formatted strings combine values. An f string lets you place variables inside a larger message. Start the string with f, then put variable names inside curly braces where their values should appear. Code example. comms report = f"Saber report: {callsign} assigned to {sector code} ({callsign length} chars)" print(comms report) Lesson 4. Common mistake to debug. If Python gives an error, check quotes and...
Full Transcript
Code example. callsign length = len(callsign) print(callsign length) Lesson 3. Formatted strings combine values. An f string lets you place variables inside a larger message. Start the string with f, then put variable names inside curly braces where their values should appear. Code example. comms report = f"Saber report: {callsign} assigned to {sector code} ({callsign length} chars)" print(comms report) Lesson 4. Common mistake to debug. If Python gives an error, check quotes and parentheses first. A frequent beginner mistake is guessing the length instead of using len(callsign), or building the report but forgetting to print it. Code example. # Prefer this: callsign length = len(callsign) # Not this: callsign length = 12 Micro Trial Steps.
Code example. callsign length = len(callsign) print(callsign length) Lesson 3. Formatted strings combine values. An f string lets you place variables inside a larger message. Start the string with f, then put variable names inside curly braces where their values should appear. Code example. comms report = f"Saber report: {callsign} assigned to {sector code} ({callsign length} chars)" print(comms report) Lesson 4. Common mistake to debug. If Python gives an error, check quotes and...