0% found this document useful (0 votes)
23 views9 pages

Session Handout-1

The document outlines a lab assignment for a Python programming course, detailing tasks that involve writing, testing, and debugging simple Python programs. It includes various code snippets demonstrating basic operations, data types, operators, and string manipulations in Python. The assignment aims to enhance students' understanding of fundamental programming concepts.

Uploaded by

fewade2243
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)
23 views9 pages

Session Handout-1

The document outlines a lab assignment for a Python programming course, detailing tasks that involve writing, testing, and debugging simple Python programs. It includes various code snippets demonstrating basic operations, data types, operators, and string manipulations in Python. The assignment aims to enhance students' understanding of fundamental programming concepts.

Uploaded by

fewade2243
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/ 9

FACULTY OF TECHNOLOGY

Information & Communication


Technology
Subject: PWP -01CT1309

Lab 1
Name: Jefin Date: 05-07-2022
Enrollment No: 92100133013

CO1: To write, test, and debug simple Python programs

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:

CO2: To implement Python programs with conditional, loops and functions

#Data Types in Python


a=2
type(a)

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)

#2.Arithmetic operator - {+,-.*,**,/,//}


a=10
b=15
print('SUM=',a+b,type(a+b),end=" / ")
print('SUB=',a-b,type(a-b),end=" / ")
print('MUL=',a*b,type(a*b),end=" / ")
print('POW=',a**b,type(a**b),end=" / ")
print('DIV=',a/b,type(a/b),end=" / ")
print('MOD=',a//b,type(a//b),end=" / ")

|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

You might also like