Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
34 Cards in this Set
- Front
- Back
What is a Python Virtual Environment used for? |
It creates a separate logical directory from the rest of the Linux directory, so different projects can be worked on in different virtual environments |
|
Which command installs Python Virtual Environments? |
"pip install venv" |
|
What command creates a Python Virtual Environment? |
“python3 -m venv (dirname)” |
|
How do you activate the Virtual Environment? |
"source dirname/bin/activate"
|
|
What file is created to install all tools needed for your Development Environment? |
"requirements.txt" |
|
What kind of Python operators can you use to install exact or certain versions of programs listed in the requirements.txt file? |
Boolean Operators can be == / <= / >= to indicate exact version # / version less than or equal to defined version # / greater than or equal to the defined version # |
|
What commands do you enter to save the state of the virtual environment and exit? |
"pip freeze" to save and "deactivate" to exit |
|
What Python Data types are "mutable"? |
List, Dictionary, Set |
|
What Python data type is objects enclosed in a Parenthesis? ( ) |
Tuple - Contains random data types like strings / integers / floats |
|
What Python data type is in Key:Value Pairs in curly brackets? { } |
Dictionary - Unordered Key:Value pairs |
|
What Python data type is in curly brackets but not Key:Value pairs? { } |
Set - Unordered set of unique objects |
|
What Python data type is in straight brackets? [ ] |
List - Sequence of objects delimited by quotes (strings) |
|
What are Methods in Python? |
They are functions from a library imported or built in, to manipulate Python objects |
|
How do you see an imported libraries Methods or Functions that can be used? What is the Verbose help file on the library? |
"help(libraryname)" for the Verbose help file, or "dir(libraryname)" to just see the functions |
|
What does zero indexing mean in Python? |
Whether it is a string or a list of items, objects start in the 0 position, so "Hello" is 0-4 characters when working with manipulating that object! |
|
What is PEP8? What is PyPI? |
PEP8 is "Python Enhancement Proposal" best practices, PyPI is the python "pip" library |
|
What is an "if" Statement? How is it different from a Loop? |
If Statements in Python run through a Boolean series of truths that branch out to a final result (if / elif / else) and then the scripts ends |
|
Which Loop type can cause an infinite loop? |
A "while" loop that never stops iterating |
|
What is a "while" loop used for? |
It is used to iterate repeatedly, likely running some embedded function within the loop, until it hits the end of the loop and exits |
|
What is a "for" loop? |
"for" loops are used to perform an action based on the criteria specified, like a range of numbers |
|
What does the "break" statement do? |
It exits a "while" loop that is meant to be infinite until the correct input is received, such as the loop "while True:" will loop forever with no break |
|
How do you begin to create a custom function? |
"def functionname():" |
|
Do you use 1 tab or 4 spaces for Python indentation between code blocks? |
4 spaces as tabs give different indentation in different environments |
|
What is a Python "Class"? |
Classes are created to define a generic object that can be referenced over and over to not type the same code for every time you use the same data / objects |
|
What are *args and *kwargs when creating a custom function? What purpose do they serve? |
Args and Kwargs are used as Variables when you are not sure how many variables might pass through your function, "def functionname(*args): or "def functionname(**kwargs): |
|
What is DRY and KISS in Python? |
PEP8 concepts "Don't repeat yourself" and "Keep it simple stupid!" |
|
What is "inheritance" in Python? |
Inheritance is creating a new class from an existing class that share the same attributes, the existing class is basically copied into the new class along with any extra objects your define |
|
What is Object Oriented Programming vs Procedural Programming? |
Object Oriented Programming is meant to re-use code / objects within a script, whereas Procedural Programming is code meant to execute from top to bottom in one iteration |
|
What module allows you to use files from the underlying OS that you are running Python in? |
"import os" |
|
What are "dunders" and "magic methods" in Python? How or they identified? |
They perform core functions in Python like initializing a newly created Class with "__init__" and are identified by the two underscores on each side of the object |
|
How do you create your own module / library to import into another Python script, and use the functions within it in a new script? |
Create a Python script, "import sys" in the new script, then you can "from (script) import (function)" into the new script |
|
What kind of Python Object cannot be imported into a script and functions extracted for use? |
Classes that are created via Inheritance from an existing Class, |
|
What are the 3 main ways to use Modules in Python for DEVASC exam day? |
Importing "pip" built in modules, creating your own modules (scripts), or writing code in C# and compiling it before using in your Python script |
|
Which module can you import to allow Python to interact with objects on your device? |
"import sys" |