1. Prof. Neeraj Bhargava
Vishal Dutt
Department of Computer Science, School of
Engineering & System Sciences
MDS University, Ajmer
2. Introduction
Developed by Guido Van Rossum and released in 1991.
Named after Monty Python
Interpreted language: work with an evaluator for
language expressions.
Python used for:
web development (server-side),
software development,
mathematics,
system scripting.
3. Python Syntax & Example
>>> print("Hello, Python!")// writing on Interpreter directly
Hello, Python! //Output
OR
C:UsersDCS>python file1.py //a python file on the server
with .py Extension
4. Indentation
Indentation alludes to the spaces toward the start of a
code line.
Where in other programming dialects the space in
code is for meaningfulness just, the space in Python is
significant.
Python utilizes space to show a block of code.
if 1 > 0:
print(“One is greater!")
if 1 > 0:
print(“One is greater!")
5. Comments
Python has commenting capability for the purpose of
in-code documentation.
Comments start with a #, and Python will render the
rest of the line as a comment:
#This is comment line.
print(“Hello Python!")
6. String
Enclosing characters in quotes, called String.
strVar1 = 'Hello'
strVar2 = "Python“
Accessing Values
strVar1 = 'Hello World!'
strVar2 = "Python Programming"
print “strVar1[0]: ", var1[0]
print “strVar2[1:5]: ", var2[1:5]
single quotes the
same as double
quotes in python
#Output
strVar1[0]: H
strVar2[1:5]: ytho
7. Numbers
Number data types store numeric values. They are
immutable data types, means that changing the value
of a number data type results in a newly allocated
object.
Example:
numVar1 = 11
numVar2 = 10
print(numVar1)
print(numVar2)
8. Deleting Object
We can also delete the reference to a number object by
using the del statement. The syntax of the del
statement is −
del numVar1[,numVar2[,numVar3[....,numVarN]]]]
OR
del numVar1
del numVar1, numVar2