0% found this document useful (0 votes)
26 views

Python Basics Day 1

Uploaded by

Sumaya Akter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Python Basics Day 1

Uploaded by

Sumaya Akter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Thumbnail

Copyright Intellipaat. All rights reserved.


Agenda
01 Introduction to Python 02 Installation

03 Variables in Python 04 Python Operators

Copyright Intellipaat. All rights reserved.


Introduction to Python

Copyright Intellipaat. All rights reserved.


Introduction to Python

Python programming language is both


procedural and object oriented
programming language that has become
quite popular among the data science
community for its ease of use and
readability.

Copyright Intellipaat. All rights reserved.


Python Installation

Copyright Intellipaat. All rights reserved.


Python Installation

You can install python on your local machines by


following these steps:

Step 1: Go to Python.org.

Step 2: Download the version that best suits


your local machine.

Step 3: Start the installation setup.

Step 4: Set python path in the installation or


manually.

Copyright Intellipaat. All rights reserved.


Jupyter Notebook

Follow the steps below to install Anaconda on your


local machines.

Step 1: Go to anaconda.com
Step 2: Download the anaconda

installer Step 3: finish the installation

setup.

Step 4: Add to Path, and launch jupyter


Copyright Intellipaat. All rights reserved.
notebook to start working.
Google Colab

Follow the steps below to use Google Colab on


your local machines.
Step 1: Go to gmail.com

Step 2: Open Google Apps

Step 3: Navigate to Google Colab

Step 4: Start working on the Google Colab


Notebooks.

Copyright Intellipaat. All rights reserved.


Variables in Python

Copyright Intellipaat. All rights reserved.


Variables in Python

A variable in python or any other


programming language can be termed as a
temporary storage location that will store a
particular value for that particular variable.

Copyright Intellipaat. All rights reserved.


How to declare a variable in Python?

Declaring a variable in python is as easy as


writing code in simple english language. You
can use an assignment operator to directly
assign a value to any variable, although there
are certain rules that must be followed in
order to declare variables in Python.

Copyright Intellipaat. All rights reserved.


Multiple Variable Assignment in Python

We can declare multiple variables in a single line


of code in python as well.

Copyright Intellipaat. All rights reserved.


Naming Conventions in Python

Variables in Python are case sensitive

A variable name cannot start with a number

A variable name can consist of alphanumeric characters

A variable name can start with a character or an underscore

Copyright Intellipaat. All rights reserved.


Global Variables in Python

Global variables are those that can be used


outside the scope of a class, function, etc.
To create a global variable inside a function,
you can use the global keyword as well.

Copyright Intellipaat. All rights reserved.


Python Operators

Copyright Intellipaat. All rights reserved.


Python Operators

An operator serves as the


keywords/symbols that are used to perform
any operation on one or more
variables/values, etc.

Copyright Intellipaat. All rights reserved.


Types of Operators in Python

Assignment Comparison Identity Bitwise


Operators Operators Operators Operators

Arithmetic Logical Membership


Operators Operators Operators

Copyright Intellipaat. All rights reserved.


Assignment Operators

Assignment operators are those operators


that will help in executing the assignment of
some value to the operands.

Copyright Intellipaat. All rights reserved.


Assignment Operators

Assignment Operator Description

= equals

+= x += 5 is same as x = x + 5

-= x -= 5 is same as x = x - 5

*= x *= 5 is same as x = x * 5

/= x /= 5 is same as x = x / 5

%= x %= 5 is same as x = x % 5

//= x //= 5 is same as x = x // 5

Copyright Intellipaat. All rights reserved.


Assignment Operators

Assignment Operator Description

&= x &= 5 is same as x = x & 5

|= x |= 5 is same as x = x | 5

^= x ^= 5 is same as x = x ^ 5

**= x **= 5 is same as x = x ** 5

<<= x <<= 5 is same as x = x << 5

>>= x >>= 5 is same as x = x >> 5

Copyright Intellipaat. All rights reserved.


Arithmetic Operators

Arithmetic operators are those operators that


will help in performing an arithmetic
operation between the operands.

Copyright Intellipaat. All rights reserved.


Arithmetic Operators

Arithmetic Operator Description

+ Add

- Subtract

* Multiply

/ divide

** Exponent

// Floor Division

% Modulus

Copyright Intellipaat. All rights reserved.


Comparison Operators

Comparison operators are used to compare


two or more values.

Copyright Intellipaat. All rights reserved.


Comparison Operators

Comparison Operator Description

< Smaller

> Greater

<= Less than equal to

>= Greater than equal to

== Equals

!= Not Equals

Copyright Intellipaat. All rights reserved.


Logical Operators

Combining multiple statements through a logic is where the logical


operators are used in programming languages, especially while comparing
or in
if-else(conditional) statements.

Logical Operator Description


AND Returns true if both the statements are true
OR Returns true if one of the statements is true
NOT Returns False, if the statement is True, and vis-a-vis

Copyright Intellipaat. All rights reserved.


Identity Operators

Identity operators in python are used to compare if the objects are in fact
the same object or not.

Identity Operator Description


is Returns true if same object.
is not Returns true if not the same object.

Copyright Intellipaat. All rights reserved.


Membership Operators

Membership operators in python will check if the sequence is present in


the object or not.

Membership Operator Description


in Returns true if the sequence is present
not in Returns true if the sequence is not present

Copyright Intellipaat. All rights reserved.


Bitwise Operators

Bitwise operators are used to compare binary


values.

Copyright Intellipaat. All rights reserved.


Bitwise Operators

Bitwise Operator Description

& Sets both bits to 1 if both of them are 1.

| Sets both bits to 1 if one of them are 1.

^ Sets both bits to 1 if only one of them is 1.

~ sets the bits to inverse of each of them

<< Zero fill left shift

>> Zero fill right shift

Copyright Intellipaat. All rights reserved.


Thank You

Copyright Intellipaat. All rights reserved.


India: +91-7022374614

US: 1-800-216-8930 (TOLL FREE)

support@intellipaat.com

24/7 Chat with Our Course Advisor

Copyright Intellipaat. All rights reserved.

You might also like