What is Python?
Python is an interpreted, high-level, object-oriented and general-purpose programming language. The meaning of the 3 important words mentioned in the definition is
- Interpreted: goes through an interpreter, which turns code you write into the machine language.
- high-level: enable the programmer to write programs that are more or less independent of a particular type of computer.
- object-oriented: object-oriented programming (OOP) is a programming language model organized around objects rather than “actions” and data rather than logic.
- general-purpose: It can be used in various domains like data science, Artificial intelligence(AI), Machine-learning, etc.
Keywords, variables and expression in python
Keywords: Keywords are reserved words in python. In Python, keywords are case sensitive. We cannot use the keyword as a variable name and function. Only True, False and None start with a capital letter.
and del from not while as elif global or with assert else if pass yield break except import print class exec in raise continue finally is return def for lambda try
A variable is a named location used to store data in the memory. Variables are a bucket that holds data that can be changed later in the program. A variable should not contain any special character except underscore(_).
Expression statements are used to compute and write a value, or to call a procedure. Python expressions consist of identifiers, literals, and operators.
a)Identifiers: Any name used to define a class, function, variable module, or object is an identifier.
b)Literals: These are language-independent terms in Python. Python literals are categories as string literals, byte literals, integer literals, floating–point literals, and imaginary literals.
c)Operators: In Python, the operators are:
|<,>||greater than, less than|
Precedence of operation:
6)Left to right
Why python is preferred?
a)In python user don’t need to define the type of variable
b)the time required to write code is less
c)Easy to learn
d)Used in various applications.