Advanced Python Programming: Welcome To
Advanced Python Programming: Welcome To
What is Python?
Python Features
It has huge community and large ecosystem of Libraries, frameworks, and tools.
Used in Hacking
Python History
The Programming Cycle for Python
Start Application
- Jupyter - https://jupyter.org/install.html
- Spyder - https://github.com/spyder-ide/spyder
- Atom - https://atom.io/
- Thonny - https://thonny.org/
Variables and Simple Data types
What is variable? Syntax
Naming Rules
A variable name must start with a letter or the underscore character, but not with number.
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
A variable name does not contain any special symbol except underscore( _ ).
None
String
List
Tuple
Set
Range
Dictionary
Elements of Python
What is element?
Elements of Python
The process of converting data value from one data type to another
The process of converting data value from one data type to another
Operator Operand
= identifier
+ Literals
and
is not
<<
Expressions in Python
Examples
“hello” [number for number in range(10)] - List
=
Syntax
variableName = value
variableName = anotherVariableName
variableName = expression
Arithmetic Operators in Python
+ Addition | Concatenation
- Subtraction
** Exponent
/ Division
% Remainder
Operator Precedence in Python
Precedence Operator
What is operator precedence?
1 () [] {}
2 Subscription, slicing, call, attribute
3 **
Operator precedence decides the 4 +x, -x, ~x
order of operators to be evaluated in 5 *, /, //, %
an expression
6 +, -
7 <<, >>
8 &
9 ^
10 |
11 in, not in, is, is not, <, <=, >, >=, !=, ==
12 not x
13 and
14 Or
Boolean expression in Python
What is Boolean expression?
Any non-empty list, tuple, set, dictionary Any empty list, tuple, set, dictionary
Value None