Basics Flashcards
(31 cards)
Escape characters

String literals can span multiple lines.
One way is using triple-quotes: “"”…””” or ‘'’…’’’. End of lines are automatically included in the string, but it’s possible to prevent this by adding a \ at the end of the line. The following example:

Concatination and repeats
the + operator, and repeated with *

String indexing

String slicing

One way to remember how slices work is to think of the indices as pointing . . .

String immutability

Lists

Indexing and Slicing lists

Slicing lists

Concatinating lists

List mutability

len()

Nesting Lists

print()

end

multiple assignment
a, b = 0, 1
The variables a and b simultaneously get the new values 0 and 1. On the last line this is used again, demonstrating that the expressions on the right-hand side are all evaluated first before any of the assignments take place. The right-hand side expressions are evaluated from the left to the right.
if Statements

for Statements

the range() function

To iterate over elements in a range . . .

A strange thing happens if you just print a range:

the break statement

the continue statement






