reading-notes

View project on GitHub

Dunder Methods:

Dunder methods let you emulate the behavior of built-in types. For example, to get the length of a string you can call len(‘string’)

you can use them to enrich your classes. They are easy to recognize because they start and end with double underscores, for example init or str.

Special Methods and the Python Data Model:

This elegant design is known as the Python data model and lets developers tap into rich language features like sequences, iteration, operator overloading, attribute access. You can see Python’s data model as a powerful API you can interface with by implementing one or more dunder methods. If you want to write more Pythonic code, knowing how and when to use dunder methods is an important step.

Some Dunder Methods:

Object Initialization: init

Object Representation: str, repr

Object Representation: str, repr

Iteration: len, getitem, reversed

Operator Overloading for Comparing Accounts: eq, lt

Basic Statistics in Python — Probability:

probability(chance of an event happening): An event is some outcome of interest.

Statistics: is the discipline that concerns the collection, organization, analysis, interpretation, and presentation of data.

Z-score:

The Z-score is a simple calculator that answers the question, “Given a data point, how many standard deviations is it away from the mean?” The equation below is the Z-score equation.

Descriptive statistics: are used to describe the basic features of the data in a study. They provide simple summaries about the sample and the measures. Together with simple graphics analysis, they form the basis of virtually every quantitative analysis of data.

Inferential statistics: are often used to compare the differences between the treatment groups. Inferential statistics use measurements from the sample of subjects in the experiment to compare the treatment groups and make generalizations about the larger population of subjects.

Resources:

Done by Omar-zoubi