Python 3 - Beginner Flashcards
What is a string?
a sequence of characters enclosed by single, double, or triple quotes
What is the escape sequence for a new line?
\n
What are the 2 main types of numbers?
Integers (int) and Floats (float)
What does the % operator do?
Returns the remainder after division of one number by another
What does the // operator do?
Integer division
What does the abs() function do?
Returns the distance between the number in parentheses and 0
What is a Boolean?
A True or False value
What does the Not operator do?
The Not operator means denying an expression.
What is a List?
a data structure in Python that is a mutable, or changeable, ordered sequence of elements. Items in a list are enclosed with [ ] brackets
What is a set?
An unordered collection of unique elements. Sets are enclosed in { } curly brackets
What is a tuple?
Tuples are immutable lists (their contents cannot be changed by adding, removing, or replacing elements). Tuples are enclosed in ( ) round brackets.
What is a frozenset?
Frozensets are immutable sets.
What are Ranges?
The range() function is used to generate a sequence of numbers over time. (start, end, step)
What are dictionaries?
a dictionary is an unordered set of key value pairs.
dict1 = { “1”: “One”, “2”: “Two”}
How do if/elif/else statements operate?
code is executed based on one or more conditions being evaluated as True or False. Once conditions are met, the code is run and any code following is ignored.