SlideShare a Scribd company logo
1 of 25
PPT prepared by : Ankita A. Shirke
Python is a powerful general purpose programming language.
It has a simple easy to use syntax similar to the English
language.
Python has syntax that allows developers to write programs with
fewer lines than some other programming languages.It was
developed by Guido van Rossum in 1991.
It is used in web development , data science , creating software
prototypes, and so on.
Why Learn Python?
Python is currently the most widely used multi-purpose, high-
level programming language, which allows programming in
Object-Oriented and Procedural paradigms. Python programs
generally are smaller than other programming languages like
Java. Programmers have to type relatively less and the
indentation requirement of the language, makes them
readable all the time.
• LANGUAGE FEATURES
Interpreted
There are no separate compilation and execution
steps like C and C++.
Directly run the program from the source code.
Internally, Python converts the source code into
an intermediate form called byte codes which is
then translated into native language of specific
computer to run it.
No need to worry about linking and loading with
libraries, etc.
Python vs JAVA
Python
 No need to declare anything.
An assignment statement
binds a name to an object,
and the object can be of any
type.
 No type casting is required
when using container objects
 Uses Indentation for structuring
code
JAVA
 All variable names (along
with their types) must be
explicitly declared.
Attempting to assign an
object of the wrong type to a
variable name triggers a type
exception.
 Type casting is required
when using container
objects.
 Uses braces for structuring code
Python Variables
Variables is a named location used to store data in memory.
Variable names are case-sensitive.
Example
x = 5
y = "John"
print(x)
print(y)
Output
5
John
Python Data Types
Python data type is nothing but a text before
the variable which defines the type of value
stored in the variable.
Lets now explorer the standared data types
available in python.
Numbers
Int (integers like 3, 7, 23, 674 etc)
Long (long integers, which can be represented in
octal and hexadecimal formats, like – 0x17326L)
Float means decimal values ex. 6.72,67.2,10.00
Complex numbers like 20+2i,242j etc
List
List are used to store values of different data types in sequential
order.
 In simple, they are similar to arrays in C but unlike arrays, they
store values of various data types.
Lists are created using square brackets
Example
x = ["Java ", "C++", "Python"]
print(x)
Out Put
['Java ', 'C++', 'Python']
['Java ', 'C++', 'Python']
['Java ', 'C++', 'Python']
Tuple
 A Tuple is similar to that of a list.
 It also stores values of different data types. However, the major
difference is that we cannot change the size of the tuple once declared
or change the values of items stored in a tuple.
 This means a tuple is immutable.
 Tuples are written with round brackets.
x = ("apple", "banana", "cherry")
print(x)
Output
('apple', 'banana', 'cherry')
String
A string is a collection of a sequence of characters.
 print("Hello")
Strings are surrounded by either single quotation marks,
or double quotation marks.
'hello' is the same as "hello".
You can display a string literal with the print() function:
print("Hello")
Output
Hello
Set
 Sets are used to store multiple items in a single variable.
 A set is a collection which is unordered, unchangeable*, and unindexed.
 * Note: Set items are unchangeable, but you can remove items and add new
 Sets are written with curly brackets.
x = {"apple", "banana", "cherry"}
print(x)
Output
{'banana', 'apple', 'cherry'}
# Note: the set list is unordered, meaning: the items will appear in a random order.
# Refresh this page to see the change in the result.
Dictionary
 Dictionary is a collection of unordered key – value pairs.
 Dictionaries are written with curly brackets, and have keys and values:
x = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(x)
 Output
{'brand': 'Ford', 'model': 'Mustang', 'year': 1964}
In programming you often need to know if an expression is true or false.
You can evaluate any expression in python, and get one of two
answers, true or false.
When you compare two values, the expression is evaluated and python returns the
boolean answer:
logical computation . The value that
the operator operats on is called the
operand
e.g >>>6+8
14
Here + is operator and 6 and
8 are the operands
and 1 is output of the of the
operation.
 Arithmetic operators
 Assignment operators
 Comparison operators
 Logical operators
 Identity operators
 Membership operators
 Bitwise operators
Python divides the operators in the following groups
Arithmetic operators are used to
performing mathematical operations like
addition,subtraction, multiplication ,
etc.
Operator Name Example
+ Addition x + y
- Subtraction x - y
* Multiplication x * y
/ Division x / y
% Modulus x % y
** Exponentiation x ** y
// Floor division x // y
2. Logical Operator
Logical operators are used to
combining conditional statements.
Logical operators are the and , or ,
not.
Operator Description Example
and Returns True if both
statements are true
x < 5 and x < 10
or Returns True if one of
the statements is true
x < 5 or x < 4
not Reverse the result,
returns False if the
result is true
not(x < 5 and x < 10)
to assign values to variables.a=5 is a
simple assignment operator that assigns
the value 5 on the right to the variable
‘a’ on the left.
There are various compound operators in
Python like a+= 5 that adds to the
variable and later assigns the same . It
is equivalent to a = a + 5.
Comparison operators are used to
comparing values.
It returns either True or False
according to the condition.
Operator Name Example
== Equal x == y
!= Not equal x != y
> Greater than x > y
< Less than x < y
>= Greater than or
equal to
x >= y
<= Less than or equal to x <= y
is and is not are the identity
operators in Python . They are used
to check if two values ( or
variables ) are the located on the
same part of memory.
Operator Description Example
is not Returns true if both variables are
not the same object
x is not y
is Returns true if both variables are
the same object
x is y
in and not in are the membership
operators in Python. They are used to
test whether a value or variable is
found in a sequence(string, list , tuple , set and
dictionary).
In a dictionary , we can only test for
the presence of akey , not the value.
Operator Description Example
in Returns True if a sequence with the
specified value is present in the object
x in y
not in Returns True if a sequence with the
specified value is not present in the
object
x not in y
Bitwise operators act on operands as if
they were strings of binary digits .
Bitwise operators arer used to
comparing(binary) numbers . They operate
bit by bit , hence the name .For example , 2 is
10 in binary and 7 is 111.
Operator Name Description
& AND Sets each bit to 1 if both bits are 1
| OR Sets each bit to 1 if one of two bits is 1
^ XOR Sets each bit to 1 if only one of two bits is 1
~ NOT Inverts all the bits
<< Zero fill left shift Shift left by pushing zeros in from the right and let the leftmost
bits fall off
>> Signed right shift Shift right by pushing copies of the leftmost bit in from the left,
and let the rightmost bits fall off
Practicals in Python
Practical Output
x=“Hello World”
Print (x)
Hello world
X= 5
print (x)
5
x=“Python”
print (type (x))
Class ‘str,
x=5
print(type(x))
Class ‘int’
6+8
200-150
450*20
9000/45
9000//45
16**2
14
50
9000
200.0
200
256
a=9; b=2
c=a+b-a*b/a
Print (c)
9.0
Print 16//8 8
Python.pptx

More Related Content

Similar to Python.pptx

1_Python Basics.pdf
1_Python Basics.pdf1_Python Basics.pdf
1_Python Basics.pdfMaheshGour5
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.pptjaba kumar
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizeIruolagbePius
 
UNIT II_python Programming_aditya College
UNIT II_python Programming_aditya CollegeUNIT II_python Programming_aditya College
UNIT II_python Programming_aditya CollegeRamanamurthy Banda
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in PythonMSB Academy
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in PythonRaajendra M
 
An overview on python commands for solving the problems
An overview on python commands for solving the problemsAn overview on python commands for solving the problems
An overview on python commands for solving the problemsRavikiran708913
 
TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfEjazAlam23
 
Introduction to Python - Part Two
Introduction to Python - Part TwoIntroduction to Python - Part Two
Introduction to Python - Part Twoamiable_indian
 
python programming for beginners and advanced
python programming for beginners and advancedpython programming for beginners and advanced
python programming for beginners and advancedgranjith6
 
The Awesome Python Class Part-3
The Awesome Python Class Part-3The Awesome Python Class Part-3
The Awesome Python Class Part-3Binay Kumar Ray
 
modul-python-all.pptx
modul-python-all.pptxmodul-python-all.pptx
modul-python-all.pptxYusuf Ayuba
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| FundamentalsMohd Sajjad
 

Similar to Python.pptx (20)

1_Python Basics.pdf
1_Python Basics.pdf1_Python Basics.pdf
1_Python Basics.pdf
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
Python second ppt
Python second pptPython second ppt
Python second ppt
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
UNIT II_python Programming_aditya College
UNIT II_python Programming_aditya CollegeUNIT II_python Programming_aditya College
UNIT II_python Programming_aditya College
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
 
An overview on python commands for solving the problems
An overview on python commands for solving the problemsAn overview on python commands for solving the problems
An overview on python commands for solving the problems
 
PYTHON.pdf
PYTHON.pdfPYTHON.pdf
PYTHON.pdf
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdf
 
Introduction to Python - Part Two
Introduction to Python - Part TwoIntroduction to Python - Part Two
Introduction to Python - Part Two
 
python programming for beginners and advanced
python programming for beginners and advancedpython programming for beginners and advanced
python programming for beginners and advanced
 
Python basic operators
Python   basic operatorsPython   basic operators
Python basic operators
 
The Awesome Python Class Part-3
The Awesome Python Class Part-3The Awesome Python Class Part-3
The Awesome Python Class Part-3
 
modul-python-all.pptx
modul-python-all.pptxmodul-python-all.pptx
modul-python-all.pptx
 
Python
PythonPython
Python
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
python
pythonpython
python
 
Welcome to python workshop
Welcome to python workshopWelcome to python workshop
Welcome to python workshop
 

More from Ankita Shirke

Cyber Safety and cyber security. Safety measures towards computer networks a...
Cyber Safety  and cyber security. Safety measures towards computer networks a...Cyber Safety  and cyber security. Safety measures towards computer networks a...
Cyber Safety and cyber security. Safety measures towards computer networks a...Ankita Shirke
 
All about Sikkim.pptx
All about Sikkim.pptxAll about Sikkim.pptx
All about Sikkim.pptxAnkita Shirke
 
Entrepreneurial Skills.pptx
Entrepreneurial Skills.pptxEntrepreneurial Skills.pptx
Entrepreneurial Skills.pptxAnkita Shirke
 
Communication and Self Management skills.pptx
Communication and Self Management skills.pptxCommunication and Self Management skills.pptx
Communication and Self Management skills.pptxAnkita Shirke
 
How to back up data.pptx
How to back up data.pptxHow to back up data.pptx
How to back up data.pptxAnkita Shirke
 
Artificial Intelligence.pptx
Artificial Intelligence.pptxArtificial Intelligence.pptx
Artificial Intelligence.pptxAnkita Shirke
 
Fundamentals of Computers.ppt
Fundamentals of Computers.pptFundamentals of Computers.ppt
Fundamentals of Computers.pptAnkita Shirke
 
Computer Networking.pptx
Computer Networking.pptxComputer Networking.pptx
Computer Networking.pptxAnkita Shirke
 
Computer periphirals
Computer periphiralsComputer periphirals
Computer periphiralsAnkita Shirke
 
E commerce, blogging and podcasting
E commerce, blogging and podcastingE commerce, blogging and podcasting
E commerce, blogging and podcastingAnkita Shirke
 
Scratch programming introduction to game creation
Scratch programming  introduction to game creationScratch programming  introduction to game creation
Scratch programming introduction to game creationAnkita Shirke
 
File management and data organisation
File management and data organisationFile management and data organisation
File management and data organisationAnkita Shirke
 
Grade vi sub word processor tabular presentation unit 3
Grade vi  sub word processor   tabular presentation unit 3Grade vi  sub word processor   tabular presentation unit 3
Grade vi sub word processor tabular presentation unit 3Ankita Shirke
 

More from Ankita Shirke (20)

Cyber Safety and cyber security. Safety measures towards computer networks a...
Cyber Safety  and cyber security. Safety measures towards computer networks a...Cyber Safety  and cyber security. Safety measures towards computer networks a...
Cyber Safety and cyber security. Safety measures towards computer networks a...
 
All about Sikkim.pptx
All about Sikkim.pptxAll about Sikkim.pptx
All about Sikkim.pptx
 
ICT Skills.pptx
ICT Skills.pptxICT Skills.pptx
ICT Skills.pptx
 
Green skills.pptx
Green skills.pptxGreen skills.pptx
Green skills.pptx
 
Entrepreneurial Skills.pptx
Entrepreneurial Skills.pptxEntrepreneurial Skills.pptx
Entrepreneurial Skills.pptx
 
Communication and Self Management skills.pptx
Communication and Self Management skills.pptxCommunication and Self Management skills.pptx
Communication and Self Management skills.pptx
 
How to back up data.pptx
How to back up data.pptxHow to back up data.pptx
How to back up data.pptx
 
Artificial Intelligence.pptx
Artificial Intelligence.pptxArtificial Intelligence.pptx
Artificial Intelligence.pptx
 
Fundamentals of Computers.ppt
Fundamentals of Computers.pptFundamentals of Computers.ppt
Fundamentals of Computers.ppt
 
Mail Merge.pptx
Mail Merge.pptxMail Merge.pptx
Mail Merge.pptx
 
Computer Networking.pptx
Computer Networking.pptxComputer Networking.pptx
Computer Networking.pptx
 
Computer worksheet
Computer worksheetComputer worksheet
Computer worksheet
 
Mailmerge
Mailmerge Mailmerge
Mailmerge
 
Computer periphirals
Computer periphiralsComputer periphirals
Computer periphirals
 
More on Windows 10
More on Windows 10More on Windows 10
More on Windows 10
 
Computer virus
Computer virusComputer virus
Computer virus
 
E commerce, blogging and podcasting
E commerce, blogging and podcastingE commerce, blogging and podcasting
E commerce, blogging and podcasting
 
Scratch programming introduction to game creation
Scratch programming  introduction to game creationScratch programming  introduction to game creation
Scratch programming introduction to game creation
 
File management and data organisation
File management and data organisationFile management and data organisation
File management and data organisation
 
Grade vi sub word processor tabular presentation unit 3
Grade vi  sub word processor   tabular presentation unit 3Grade vi  sub word processor   tabular presentation unit 3
Grade vi sub word processor tabular presentation unit 3
 

Recently uploaded

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 

Recently uploaded (20)

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 

Python.pptx

  • 1. PPT prepared by : Ankita A. Shirke
  • 2. Python is a powerful general purpose programming language. It has a simple easy to use syntax similar to the English language. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.It was developed by Guido van Rossum in 1991. It is used in web development , data science , creating software prototypes, and so on.
  • 3. Why Learn Python? Python is currently the most widely used multi-purpose, high- level programming language, which allows programming in Object-Oriented and Procedural paradigms. Python programs generally are smaller than other programming languages like Java. Programmers have to type relatively less and the indentation requirement of the language, makes them readable all the time.
  • 4. • LANGUAGE FEATURES Interpreted There are no separate compilation and execution steps like C and C++. Directly run the program from the source code. Internally, Python converts the source code into an intermediate form called byte codes which is then translated into native language of specific computer to run it. No need to worry about linking and loading with libraries, etc.
  • 5. Python vs JAVA Python  No need to declare anything. An assignment statement binds a name to an object, and the object can be of any type.  No type casting is required when using container objects  Uses Indentation for structuring code JAVA  All variable names (along with their types) must be explicitly declared. Attempting to assign an object of the wrong type to a variable name triggers a type exception.  Type casting is required when using container objects.  Uses braces for structuring code
  • 6. Python Variables Variables is a named location used to store data in memory. Variable names are case-sensitive. Example x = 5 y = "John" print(x) print(y) Output 5 John
  • 7. Python Data Types Python data type is nothing but a text before the variable which defines the type of value stored in the variable. Lets now explorer the standared data types available in python.
  • 8. Numbers Int (integers like 3, 7, 23, 674 etc) Long (long integers, which can be represented in octal and hexadecimal formats, like – 0x17326L) Float means decimal values ex. 6.72,67.2,10.00 Complex numbers like 20+2i,242j etc
  • 9. List List are used to store values of different data types in sequential order.  In simple, they are similar to arrays in C but unlike arrays, they store values of various data types. Lists are created using square brackets Example x = ["Java ", "C++", "Python"] print(x) Out Put ['Java ', 'C++', 'Python'] ['Java ', 'C++', 'Python'] ['Java ', 'C++', 'Python']
  • 10. Tuple  A Tuple is similar to that of a list.  It also stores values of different data types. However, the major difference is that we cannot change the size of the tuple once declared or change the values of items stored in a tuple.  This means a tuple is immutable.  Tuples are written with round brackets. x = ("apple", "banana", "cherry") print(x) Output ('apple', 'banana', 'cherry')
  • 11. String A string is a collection of a sequence of characters.  print("Hello") Strings are surrounded by either single quotation marks, or double quotation marks. 'hello' is the same as "hello". You can display a string literal with the print() function: print("Hello") Output Hello
  • 12. Set  Sets are used to store multiple items in a single variable.  A set is a collection which is unordered, unchangeable*, and unindexed.  * Note: Set items are unchangeable, but you can remove items and add new  Sets are written with curly brackets. x = {"apple", "banana", "cherry"} print(x) Output {'banana', 'apple', 'cherry'} # Note: the set list is unordered, meaning: the items will appear in a random order. # Refresh this page to see the change in the result.
  • 13. Dictionary  Dictionary is a collection of unordered key – value pairs.  Dictionaries are written with curly brackets, and have keys and values: x = { "brand": "Ford", "model": "Mustang", "year": 1964 } print(x)  Output {'brand': 'Ford', 'model': 'Mustang', 'year': 1964}
  • 14. In programming you often need to know if an expression is true or false. You can evaluate any expression in python, and get one of two answers, true or false. When you compare two values, the expression is evaluated and python returns the boolean answer:
  • 15. logical computation . The value that the operator operats on is called the operand e.g >>>6+8 14 Here + is operator and 6 and 8 are the operands and 1 is output of the of the operation.
  • 16.  Arithmetic operators  Assignment operators  Comparison operators  Logical operators  Identity operators  Membership operators  Bitwise operators Python divides the operators in the following groups
  • 17. Arithmetic operators are used to performing mathematical operations like addition,subtraction, multiplication , etc. Operator Name Example + Addition x + y - Subtraction x - y * Multiplication x * y / Division x / y % Modulus x % y ** Exponentiation x ** y // Floor division x // y
  • 18. 2. Logical Operator Logical operators are used to combining conditional statements. Logical operators are the and , or , not. Operator Description Example and Returns True if both statements are true x < 5 and x < 10 or Returns True if one of the statements is true x < 5 or x < 4 not Reverse the result, returns False if the result is true not(x < 5 and x < 10)
  • 19. to assign values to variables.a=5 is a simple assignment operator that assigns the value 5 on the right to the variable ‘a’ on the left. There are various compound operators in Python like a+= 5 that adds to the variable and later assigns the same . It is equivalent to a = a + 5.
  • 20. Comparison operators are used to comparing values. It returns either True or False according to the condition. Operator Name Example == Equal x == y != Not equal x != y > Greater than x > y < Less than x < y >= Greater than or equal to x >= y <= Less than or equal to x <= y
  • 21. is and is not are the identity operators in Python . They are used to check if two values ( or variables ) are the located on the same part of memory. Operator Description Example is not Returns true if both variables are not the same object x is not y is Returns true if both variables are the same object x is y
  • 22. in and not in are the membership operators in Python. They are used to test whether a value or variable is found in a sequence(string, list , tuple , set and dictionary). In a dictionary , we can only test for the presence of akey , not the value. Operator Description Example in Returns True if a sequence with the specified value is present in the object x in y not in Returns True if a sequence with the specified value is not present in the object x not in y
  • 23. Bitwise operators act on operands as if they were strings of binary digits . Bitwise operators arer used to comparing(binary) numbers . They operate bit by bit , hence the name .For example , 2 is 10 in binary and 7 is 111. Operator Name Description & AND Sets each bit to 1 if both bits are 1 | OR Sets each bit to 1 if one of two bits is 1 ^ XOR Sets each bit to 1 if only one of two bits is 1 ~ NOT Inverts all the bits << Zero fill left shift Shift left by pushing zeros in from the right and let the leftmost bits fall off >> Signed right shift Shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off
  • 24. Practicals in Python Practical Output x=“Hello World” Print (x) Hello world X= 5 print (x) 5 x=“Python” print (type (x)) Class ‘str, x=5 print(type(x)) Class ‘int’ 6+8 200-150 450*20 9000/45 9000//45 16**2 14 50 9000 200.0 200 256 a=9; b=2 c=a+b-a*b/a Print (c) 9.0 Print 16//8 8