click below
click below
Normal Size Small Size show me how
SE Python Intro
Question | Answer |
---|---|
Python emphasizes...? | Code readability |
Python allows programmers to express concepts in...? | Fewer lines of code |
Python index always starts at...? | Zero |
Identifiers | Names that refer to a data object of some type |
List | A sequence of elements, each with an index position |
The len() function allows you to...? | Get the total number of items in a list, tuple, array, dictionary, etc |
Lists ___ hold other lists | Can |
Negative subscripts provide access to the list elements in ___ | Reverse order |
You ___ change the characters in a string | Cannot |
You ___ replace one list element with another | Can |
The append() function is used to...? | Add elements to the end of a list |
The pop() function is used to...? | Remove the element at the end of a list or a given index value |
The remove() function is used to...? | Specify which list item you want to remove no matter where in the list it is located |
The insert() function is used to...? | Add an item to a list in a specified location |
The extend() function is used to...? | Add multiple list items to an existing list |
The "in" operator is used to...? | Know whether an element is present in a list |
The concatenation of two lists in a new list contain...? | The elements of the first list followed by that of the second |
Lists can be concatenated using the ___ | Plus (+) operator |
To concatenate the same list multiple times use the ___ | Star (*) operator |
Use the ___ to compare whether two lists have the same elements in the same order | Equals (==) operator |
Table | A list in which each element is itself another list |
Two benefits of using functions | Reusability and abstraction |
Local variable | A variable that is defined within a function |
Global variable | A variable that is defined outside of a function |
Variables are ___ unless otherwise declared | Local |
Set | A container that stores a collection of unique values |
The elements of a set are...? | Not stored in a particular order and cannot be accessed by position |
A set cannot contain ___ | Duplicate elements |
Dictionary | A container that keeps associations between keys and values |
Class variables | - Defined within the class construction - Shared by all instances of the class |
Instance variables | - Owned by instances of the class - For each object or instance of a class, these variables are different - They are defined within methods and are retained from call to call |
Local variables | - Thrown away when the method is finished - Recreated the next time you call the method |