Loops and Jump Statements: If, Else, Break
Loops allow a block of code to be executed multiple times
The for loop in Python is used to iterate over a sequence
of items
The while loop is used to repeatedly execute a block of
code as long as a certain condition is true
The break statement is used to exit a loop prematurely
Strings and String Manipulation: Slicing, Split, Substring
Strings in Python are sequences of characters
Strings can be manipulated in various ways, such as by
slicing (extracting a subset of the string), splitting
(dividing the string into multiple substrings), and finding
substrings
The following code extracts a substring from a string:
s = "Hello, world!"
substring = s[7:12] # Output: "world"
Loops allow a block of code to be executed multiple times
The for loop in Python is used to iterate over a sequence
of items
The while loop is used to repeatedly execute a block of
code as long as a certain condition is true
The break statement is used to exit a loop prematurely
Strings and String Manipulation: Slicing, Split, Substring
Strings in Python are sequences of characters
Strings can be manipulated in various ways, such as by
slicing (extracting a subset of the string), splitting
(dividing the string into multiple substrings), and finding
substrings
The following code extracts a substring from a string:
s = "Hello, world!"
substring = s[7:12] # Output: "world"