A fixed value such as numbers, letters and strings
Those you can not use as identifiers (variable names) for constants
A named place in the memory where a programmer can store data and later retrieve the data using the varaible name (identifier)
Rules for varaibles names: only start with letter or underscore and they are case sensitive
- integer
- float (is dominating in presence of an integer)
- string
input()
makes Python read data from the usertype()
returns data typeint() str() float()
coverts data type to another type. The use of these is limited to logical conversions, e.g. the followingint('hello there')
returns an errordir()
returns an alphabetically sorted list containing all entities' names available in a module given as argument. e.g.dir(math)
. Before using it, the module must have been already imported.len('string')
returns the length of a string as an integer
- A module is a file containing Python definitions and statements. Each module consists of entities (functions, variables, constants, classes, and objects).
- A module user is the one that uses an existing module, meanwhile the module supplier is the one who creates a brand new module.
- A large number of modules is delivered together with Python itself. All these modules, along with the built-in functions, form the Python standard library.
- To make a module usable, it must be imported by using the
import
keyword followed by the module's name. If only a certain entity or entities from a module are wanted to import, thenfrom module import entity
. e.g.from math import pi
.
- A package is a set of modules. The presence of the init.py file finally makes up the package.
A dependency is a phenomenon that appears every time you're going to use a piece of software that relies on other software.
pip
can discover, identify and resolve all dependencies. Is uses the Internet to query PyPI content as well as download required data
pip help operation
– shows a brief description of pip
pip list
– shows a list of the currently installed packages
pip show package_name
– shows package_name info including the package's dependencies
pip search anystring
– searches through PyPI directories in order to find packages whose names contain anystring;
pip install name
– installs name system-wide (expect problems when you don't have administrative rights);
pip install --user name
– installs name for you only; no other platform user will be able to use it;
pip install -U name
– updates a previously installed package;
pip uninstall name
– uninstalls a previously installed package.
It checks if its left argument (a string) can be found (or not) anywhere within the right argument (another string).