Python Flashcards
Python3 features
Free and open sources
Object oriented Language
Portable- use on Mac, Linux, Unix
Interpreted Language- executed line by line bot compled
Dynamically typed - No need to declare var types
Automatic memory management
built-in data structures
Functions are first class objects that make difficult tasks simple
Python Memory Management
Memory management in Python involves a private heap containing all Python objects and data structures. The management of this private heap is ensured internally by the Python memory manager. The Python memory manager has different components which deal with various dynamic storage management aspects, like sharing, segmentation, preallocation or caching.
Error handeling
Try:
this block of code
Except:
do this if you hit an error
Lists
Mutable
Ordered collection of items
Can store any sort of object
some functions you can do: Slice, delete, insert, pop, reverse
Lists are great to use when you want to work with many related values. They enable you to keep data together that belongs together, condense your code, and perform the same methods and operations on multiple values at once
Opt for a list when you need an ordered sequence of items
Dictionary
Do you need to associate values with keys, so you can look them up efficiently (by key) later on? Use a dictionary.
Mutable
Unordered
Unique keys
Tuple
Immutable
Ordered
When you want to collect an immutable ordered list of elements, use a tuple. (For example, when you want a (name, phone_number) pair that you wish to use as an element in a set, you would need a tuple rather than a list since sets require elements be immutable).
Sets
Unordered Distinct Commonly used to remove dupes mutable When you want an unordered collection of unique elements, use a set. (For example, when you want the set of all the words used in a document).
algorithim
A set of specific steps for solving a category of problems
high level language
A programming language like Python that is designed to be easy for humans to read and write.
list comprehensions
Best to use when you need to create a new list from other iterables
For loop
Used to iterate through elements of an array or a list
While loop
Perform and indefinite number of iterations as long as a condition remains true
NumPy
one of the principal packages for data science applications
often used to process large multidimensional arrays, extensive collections of high-level mathematical functions and matrices
Implementation methods make it easy to conduct multiple operations with these objects
Pandas
Python is a powerful tool for data analytics which comes with a variety of built-in methods for combining, filtering, and grouping data.
Modules
Files containing Python code, can be functions, classes, or variables. Some common built-in modules are os sys math random