Session Handout-1
Session Handout-1
Lab 1
Name: Jefin Date: 05-07-2022
Enrollment No: 92100133013
Task1:
Python Code:
print('HEllo World !')
print(2+3)
print(4-3)
print(4*3)
print(4/2)
print(4//2)
print ( 'SUM=',2+3)
print ( 'SUB=',4-3)
print ( 'MUL=',2*3)
print ( 'DIV=',4//2)
a=5
b=6
print('sum=',a+b)
print('sub=',a-b)
print('MUL=',a*b)
print('DIV=',a/b)
12/13/14
print(12,end='*')
print('SUB1',end=' 1')
print(' SUB2',end=' 2')
print(' SUB3',end=' 3')
print(' SUB4',end=' 4')
|1
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
print('* * * *')
print('* *')
print('* *')
print('* * * *')
print(' * * * * ' )
print(' * *' )
print(' * *' )
print('* *')
print(' * *' )
print(' * *' )
print(' * * * *' )
print(7/3)
print(7%3)
print(2//3)
print(2%3)
c='ICT'
d='Jefin'
print('My Department name is '+c,'. My Name is '+d’ )
print(2**1,end=' 1 ')
print(2**2,end=' 2 ')
print(2**3,end=' 3 ')
print(2**4,end=' 4 ')
print(2**5,end=' 5 ')
print(2**6,end=' 6 ')
print(2**7,end=' 7 ')
print(2**8,end=' 8 ')
print(2**9,end=' 9 ')
print(2**10,end=' 10 ')
|2
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
Output:
a=2.0
type(a)
a=True
type(a)
|3
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
a="ICT"
type(a)
a=3+2j
type(a)
a=2
b=2.0
c=True
d="ICT"
e=3+2j
print(type(a),end=" / ")
print(type(b),end=" / ")
print(type(c),end=" / ")
print(type(d),end=" / ")
print(type(e))
#Operators in Python
#1.relational operator - {<,>,==,!=}
a=100
b=200
print(a>b)
print(a<b)
print(a==b)
print(a!=b)
|4
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
#3.Boolean operator - {&,|}
a=True
b=False
print()
print()
#String OPerators
a="ICT"
len(a)
a="ICT"
a.lower()
a="ict"
a.upper()
#Replace
a="ICT"
a.replace("ICT","CE")
a="ICT"
a.replace("C","T")
#split
a="My DEPARTMENT NAME IS ICT"
a.split(",")
#Count
a="My DEPARTMENT NAME IS ICT"
a.count("E")
#Indexing
|5
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
a="My DEPARTMENT NAME IS ICT"
a[0:2]
#Find
a="My DEPARTMENT NAME IS ICT"
a.find("NAME")
#Reverse task
a="MEET"
a[::-1]
#Task
a="My Name is MEet"
a.replace("My Name is MEet","My name is Meet")
Output:
|6
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
|7
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
|8
FACULTY OF TECHNOLOGY
Information & Communication
Technology
Subject: PWP -01CT1309
|9