Coding Basics Flashcards
What type of code should be in a method or function
Code that performs a discrete task and task code that is used more than once
What are arguments?
Variables you pass into functions/methods
What happens when a return statement is executed
A variable is returned
What is the difference between methods and functions?
Functions are standalone code blocks while methods are code blocks associated with an object
What is a module
a set of functions and contains an interface for other modules to integrate with
In a venv if you install a library what directory is it stored in
The /lib directory
Where directory is an executable script stored at in a venv if you install it?
in the /bin directory
What command activates the python interactive shell?
python -i
what are the three naming conventions for variables in python
Cannot start with a number [0-9]
Cannot conflict with a language keyword
Can contain: [A-Z a-z 0-9 _ -]
When should code be encapsulated into a method or a function
Code that performs a discrete task
Task code that is used more than once
What is Object-oriented programming (OOP) based off of
Encapsulation
Data abstraction
Polymorphism
inheritance
What are functions defined within a class known as
class methods
How do you create a private variable in Python
by putting a leading _ in front of a variable name
EX. _MyVariable
What do you call a python file that is intended to be executed
A script
What does the if__name__ == __main__ block do
executes the script, initialize any global variables, and so on and then call the scripts main function