Mark As Completed Discussion

One Pager Cheat Sheet

  • Python is an easy-to-read, open-source language that works on many operating systems, and has multiple applications ranging from website development to machine learning.
  • Namespaces in Python are implemented as dictionaries, providing an efficient data structure for mapping variables and their values to ensure no naming collisions occur.
  • Namespaces in Python are containers that hold objects and their names as keys and values respectively, with each function, module, or library having its own unique namespace.
  • Objects in Python have specific data types which determine what kinds of information they store and how they behave when used or manipulated.
  • Python offers a wide variety of data types to handle data, including numeric, text, and Boolean.
  • Python int, float, and complex data types are used to represent numeric information.
  • Strings, defined using ' ' or " ", are a type of text data that can include any number, word, sentence, or special character.
  • In Python, boolean data is of class 'bool' and has either a True or False value.
  • We need to invoke or call a function to execute it, which is usually represented by the function's name followed by parenthesis ().
  • The most commonly used built-in functions in Python are print(), len(), min(), max(), type(), and isinstance().
  • The print() function can be used to output strings, variables, and even literal values like integers and booleans.
  • We can use the len() function to find the length of a string, list, tuple, and dictionary.
  • The min() function finds the minimum value of a string, list, tuple, dictionary or multiple values passed as a parameter, resulting in -10 when multiple values are passed.
  • The max() function finds the maximum value of a string, list, tuple, dictionary, or of multiple values passed to it as parameters.
  • We can create different variables and check their types using the type() function.
  • The isinstance() function checks if a given value is of a specific data type.
  • List comprehensions are an efficient and effective way to loop and filter through data, requiring fewer lines of code and often being more computationally efficient.
  • Dict and List Comprehensions are concise ways of creating new objects from existing ones, utilizing keys and values for dictionaries and indices and values for lists.
  • List Comprehensions allow for quickly creating a new list from an existing one using the expression for each variable within the list that meets certain conditions.
  • An operand is the object that an operator is applied to.
  • Yes, Python has multiple types of operators such as comparison, identity, membership, and assignment which can be used for different purposes.
  • An object is iterable when it implements the iterator protocol which consists of the iter() and next() methods for initializing the iterator and calling the next item, respectively, and raising the StopIteration exception when the final item is reached.
  • Iterators encapsulate the iteration process and are essential to accessing objects in Python.
  • Yes, a generator is a function that returns an iterator and can yield a sequence of values without storing them in memory.
  • A generator is a special type of function marked by the yield keyword, which returns an iterator object that can only be used with the for-in loop or next() methods.
  • Object Oriented Programming (OOP) relies heavily on classes and objects, which serve as blueprints that describe the attributes, behaviors, and construction of a real-life object that can be created and have its methods and attributes accessed.
  • OOP in Python utilizes traditional concepts such as classes, objects, inheritance, encapsulation, polymorphism, and abstraction, just with a different syntax.
  • Inheritance, Encapsulation, Polymorphism, and Abstraction are all key principles of Object Oriented Programming that allow developers to create organized, extensible, and powerful software.
  • Decorators can be used to add functionality to a function by being wrapped around it.
  • Decorators in Python can be used to add some feature or functionality to an existing function without altering it, like hanging a picture frame to enhance a room.
  • We have used a swipe_decorator() to add the functionality to our divide() function so that it swaps the values before they get divided if first < second.
  • Data Structures in Python are Mutable, Ordered, allow for Duplicates and Different Objects and can be used for quickly retrieving relevant data with unique labels by using a Dictionary, and the difference between sorted() and .sort() is that sorted() creates another list that is sorted whereas .sort() changes our original list.
  • A Tuple is an immutable data structure that does not allow for changes to be made after it is created.
  • Slicing is a way of programatically accessing parts of Lists, Strings, and Tuples by using ObjectName[start:stop:step].
  • In slicing, the Stop index is not inclusive of the element at the specified index, which can be demonstrated by looking at the result of my_list[1:4] and my_list[-1:-4:-1].
  • This article explores the use of Python (with import pandas and numpy) to solve Glassdoor interview questions related to aggregating data and working with datasets.