Python is a high-level, general-purpose, interpreted, dynamic, and prototype-based programming language. It was created by Guido van Rossum, and released in 1991.
It was designed with an emphasis on code readability, and its syntax allows programmers to express their concepts in fewer lines of code.
Python is a programming language that lets you work quickly and integrate systems more efficiently. There are two major Python versions: Python 2 and Python 3.
It is often used as a scripting language for web development and data science.
Python Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data. Since everything is an object in Python programming, Python data types are classes and variables are instances (objects) of these classes.
Python variables are containers for storing data values. Python has no command for declaring a variable.Python is completely object oriented, and not "statically typed".
You do not need to declare variables before using them, or declare their type. Every variable in Python is an object.
In Python programming, Operators in general are used to perform operations on values and variables. These are standard symbols used for logical and arithmetic operations. In this article, we will look into different types of Python operators.
Operators | Type |
---|---|
+, -, *, /, % | Arithmetic operator |
<, <=, >, >=, ==, != | Relational operator |
AND, OR, NOT | Logical operator |
&, |, <<, >>, ~, ^ | Bitwise operator |
=, +=, -=, *=, %= | Assignment operator |
Expressions are representations of value. They are different from statement in the fact that statements do something while expressions are representation of value. For example any string is also an expressions since it represents the value of the string as well. Python has some advanced constructs through which you can represent values and hence these constructs are also called expressions.Python expressions only contain identifiers, literals, and operators. Identifiers: Any name that is used to define a class, function, variable module, or object is an identifier. Literals:These are language-independent terms in Python and should exist independently in any programming language. In Python, there are the string literals, byte literals, integer literals, floating point literals, and imaginary literals. Operators:In Python you can implement the following operations using the corresponding tokens.
Character | Meaning |
---|---|
. | Matches any single character except the newline character. |
^ | Matches a pattern at the start of the string. |
$ | Matches the end of the string. |
[] | Matches the set of characters you specify within it. |
\ | Escapes a metacharacter. |
\w | Matches any single letter, digit, or underscore. |
\W | Matches any character not part of \w. |
\s | Matches a single whitespace character like: space, newline, tab, return. |
\S | Matches any character not part of \s. |
\d | Matches decimal digit 0-9. |
\D | Matches any character that is not a decimal digit. |
+ | Checks if the preceding character appears one or more times. |
* | Checks if the preceding character appears zero or more times. |
? | Checks if the preceding character appears exactly zero or one time. |
{} | Checks for an explicit number of times. |