UNIT- 3
Python Programming
INTRODUCTION TO PYTHON
Python is general-purpose ,high level programming language. It was
created by Guido van Rossum , and released in 1991.
It is know for its clear and readable syntax.
PYTHON is a programming language that is widely used in web
application,software development,data science and machine
INTERPRETED:
Python code is executed line by line by an interpreter,without the
need for a separate compilation [Link] facilitation rapid
prototyping and debugging.
HIGH-LEVEL:
It abstraats away many low level details of computer hardware and
memory management,allowing developers to focus on problem-
solving
DOWNLOAD PYTHON
To down load Python on
Windows , navigate to the official Python
website and download the appropriate
installer.
After downloading, run the installer,
making sure to check the box to add
Python to your PATH environment variable.
Finally, verify the installation by opening a
command prompt and typing
VARIABLE
• Variables are used to store data values.
• Python defines four types of variables:
1 .local
[Link]
[Link]
[Link] variables
EXAMPLES
VARIABLE
a=5
b = "John"
abc = {1,2,3,4,5}
mylist = ["x","yy","zzz"]
print(a)
print(b)
print(abc)
print(mylist)
OUTPUT
5
John
{1, 2, 3, 4, 5}
['x', 'yy', 'zzz']
DATA TYPES
Integer DATA
Stores TYPES
whole number a=10
Boolean Boolean is used to Result=True
represent the truth values
of the
Expressions .It has two
values True&False
Floatingpoint Stores numbers with x=5.5
fractional part
Complex Stores a number having num=a+b j
real and imaginary part
String immutable sequences name=“Ria”)
(After creation values
cannot be changed in-
place)
Stores text enclosed
insingle or double quotes
List Mutable sequences (After lst=[25,15.6,“car”, “XY”]
creation values can be
changeding-place)
Stores list of comma
separated values of any data
Type between square[]
•
Tuple Immutable sequence (After tup=(11,12.3,“abc”)
creation values cannot be
changed in-place)
Stores list of comma
separated values of any data
Type between parentheses()
Set Set is an unordered collection s={25,3,3.5}
of values,of any type,
With no duplicate entry.
Dictionary Unordered set of comma- dict={1:“One”,2:
separatedkey:value pairs “Two”,3:“Three”}
With in braces{}