Python Prime Week:-

What is Python ?

• Python is Easy to learn.

• Powerful Programming language.

• It has efficient high-level data structures and a simple but effective

approach to object-oriented programming.

• it is an ideal language for scripting and rapid application

development in many areas on most platforms.

. Python is easy to learn.

. Python is well suited to data science and data analytics.

. Python is efficient, fast, and reliable.

. Hundreds of python libraries and frameworks.

. Mature and supportive community.

History of python?

. Python was created by Guido van

Rossum, and first released on February

20, 1991.

. Monty Python's Flying Circus”, a BBC

comedy series from the 1970s.

Variables and Keywords

Variable:

Variable are the containers that is used to hold the values.

Example:

x = 5

name = “python”

Keywords:

Keywords are the set of reserved words that can not be used as variable name,

function name or any other identifiers.

Example :

AND, OR, BREAK, PASS, TRY, TRUE,FALSE,WHILE etc.

operators:

Operators are used to perform operations on the variable and

values.

Example : Addition, Subtraction, Multiplication etc.

Types of Operators:-

1. Arithmetic Operator

2. Comparison Operator

3. Logical Operator

4. Bitwise Operator

1. Arithmetic Operator

Operator Function

+ Addition

- Subtraction

* Multiplication

/ Division

Arithmetic Operator are used to perform

arithmetic calculation of the expression.

2. Comparison Operator

Operator Function

\> Greater than

< Less than

\== Equality

!= Not Equal to

\>= Greater than equal to

<= Less than equal to

Comparison operators are used compare two

expression and return True or False statement.

3. Logical Operator

Operator Function

AND Logical AND

OR Logical OR

NOT Logical NOT

Logical Operator is used on

Conditional Statements.

4. Bitwise Operator

Operator Function

& Bitwise AND

| Bitwise OR

~ Bitwise NOT

^ Bitwise XOR

\>> Bitwise right shift

<< Bitwise left shift

Bitwise Operator is used to

preform bitwise calculation

on binary digits.

AND

0 0 0

1 0 0

0 1 0

1 1 1

. Returns True if both are correct.

. Returns False if any of the statement

is wrong.

. If both of the expressions are True in

that case the last value is returned

OR

0 0 0

1 0 1

0 1 1

1 1 1

. Returns True if any of the expression

is True.

. Returns False if both of expression is

False.

. If both the expression is True then

First expression is returned.

Difference between AND and OR operator.

AND

. Checks whether both expressions are logically True.

. Returns True if both are correct.

. Returns False if any of the statement is wrong.

. If both of the expressions are True in that case the last value is returned.

&

. Performs bitwise AND Operation on the result of both the statements.

Control Flow in Python

. Control flow helps us in decision making.

. It helps to maintain the flow of the program.

. If Statement

. If-else statement

. If-elif statement

# If Statement:

Syntax :

if condition:

<statements>

Loops in Python:

. Loop helps to iterate over a iterable and repeat the

task until it reaches to the end of it’s target limit.

. We have for Loops and while Loops in python.