
What it’s about
This primer tutorial covers some of the Python basics of strings and characters. These skills will help build your cybersecurity skills and serve you well in competitions with the cyber:bot.
Strings are sequences of characters. For example, “ABC” is a string of characters. Computer software, apps, and Internet communication all depend heavily on strings. For example, much of the communication between browsers and servers over the Internet contains strings. These strings might contain Internet searches, GPS coordinates, text messages and more. Many of the messages you see on web pages and in apps also started as strings.
The Cybersecurity tutorials also rely heavily on strings to exchange radio messages between cyber:bot robots and other micro:bit modules. These strings may have packet data that could contain a code for a particular cyber:bot, navigation instructions, and even sensor values. They can be encrypted by the center and decrypted by the receiver to prevent misuse if intercepted by another team. So, later, you’ll use a micro:bit to send and another to receiver, but here, we’ll focus on the string and character basics using scripts that a single micro:bit will run.
Before you start
You will need:
- A micro:bit module (on or off a cyber:bot)
- A USB A to MicroB cable
- A computer with access to python.microbit.org.
Complete these tutorials first:
After you finish
You have skills with character and string basics you’ll use in upcoming tutorials for packetizing, parsing, encrypting, decrypting, and evaluating:
- Create and access strings, substrings, and characters
- Manipulate string information to create modified strings from existing strings and characters
- Check strings for certain information
- Convert strings to other data types, process the data, and convert back to stings
- Embed Python expressions and even executable statements in strings
After this, you will also be ready to move on to the next tutorials:
Curriculum
- 1 Section
- 26 Lessons
- Lifetime
- Strings & Characters Primer26
- 1.1About Strings and Characters
- 1.2Strings for Exchanging Data
- 1.3String Features: Indexing, Functions, Methods
- 1.4First String
- 1.5Try This: Display with Variable Labels
- 1.6Characters Inside Strings
- 1.7Try This: Print Alphabets
- 1.8Your Turn: Print ASCII Chart
- 1.9Access Characters
- 1.10Try This: Check String Length
- 1.11Your Turn: Check Every Character
- 1.12String Surgery
- 1.13Try This: Access Substrings
- 1.14Your Turn: Create a Modified String
- 1.15Compare, Find, Check
- 1.16Try This: Find the Substring
- 1.17Your Turn: Exact Match vs Found in String
- 1.18Other Useful Methods
- 1.19Try This: Accept in Any Case
- 1.20Your Turn: Careful with string.replace
- 1.21Convert Between Other Data Types
- 1.22Try This: Check Variable Type
- 1.23Your Turn: String to Int, Math and Back
- 1.24Embed Code in Strings
- 1.25Try This: Execute Statements from a String
- 1.26Your Turn: A Script that Runs Scripts You Enter