0% found this document useful (0 votes)
5 views46 pages

Python Lab File

The document outlines the vision and mission of the University Institute of Technology, RGPV, focusing on nurturing skilled Computer Science and Engineering professionals with strong ethical values. It details the program educational objectives, outcomes, and specific outcomes for graduates, emphasizing technical skills, problem-solving abilities, and ethical standards. Additionally, it includes general laboratory instructions and a code of conduct for students in the Computer Science and Engineering department.

Uploaded by

artistic.ash1694
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views46 pages

Python Lab File

The document outlines the vision and mission of the University Institute of Technology, RGPV, focusing on nurturing skilled Computer Science and Engineering professionals with strong ethical values. It details the program educational objectives, outcomes, and specific outcomes for graduates, emphasizing technical skills, problem-solving abilities, and ethical standards. Additionally, it includes general laboratory instructions and a code of conduct for students in the Computer Science and Engineering department.

Uploaded by

artistic.ash1694
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

University Institute of Technology, RGPV

VISION

To nurture and enlighten the budding talents into socially committed & dexterous
Computer Science & Engineering professionals, possessing a robust foundation
and adaptable attitude for rapid technological advancements in the field along
with sustainable ethical values, to meet global challenges.
MISSION

• To persistently endeavor for the consistent development of students by


providing them a robust foundation in knowledge arena by enabling students
to imbibe the very essence and philosophy of Computer Science &
Engineering domain.

• To continuously strive for the overall development of students by educating


them in blooming cutting edge technology.

• To curate a conductive environment for exploring, analyzing and applying


knowledge to improve technical & interpersonal skills of students.

• To inculcate ethics, environmental awareness and societal commitment


contributing to their professional personality to serve better for a sustainable
global society.

• To provide an exposure of Innovative research culture in the demanding arena


of Computer Science & Engineering.
University Institue Of Technology,RGPV
DEPARTMENTOFCOMPUTERSCIENCEANDENGINEERING

VISION&MISSION

VISION

Strive to be a Centre of Excellence in Computer Science engineering and producing

graduate engineers instilled with human values and professional ethics, who will serve as
a valuable resource to the nation.

MISSION

• To build strong technical foundation through balanced curriculum, high


quality teaching and practical skills.
• To groom the graduating engineers for Industry, Research and Higher
Education.
• To inculcate human, ethical and moral values by providing a congenial
environment.
University Institue Of Technology,RGPV

DEPARTMENTOFCOMPUTERSCIENCEANDENGINEERING

PROGRAMEDUCATIONALOBJECTIVES

PEO1: Job Opportunities: To attain professional competency in the fast growing


area of Computer Science & Engineering.

PEO2: Research and Development: To be able to apply knowledge of basic


sciences and core engineering to pursue higher education, research and also to be
able to work in competitive multidisciplinary environment.

PEO3:Entrepreneur: To flourish as a socially committed Computer Science &


Engineering grandaunts, possessing state of the art domain
Knowledge, entrepreneurial skill, problem solving & research Attitude, good
leadership qualities and high ethical values.
University Institue Of Technology,RGPV

DEPARTMENTOFCOMPUTERSCIENCEANDENGINEERING

PROGRAMOUTCOME

Engineering graduateswillbeable to:

PO1: Engineering Knowledge - Apply the knowledge of mathematics, science,


engineering fundamentals and an engineering specialization to the solution of
complex engineering problems.

PO2: Problem Analysis - Identify, formulate, review research literature and analyze
complex engineering problem reaching substantiated conclusions using first
principle of mathematics natural science and engineering science.

PO3: Design/Development of solutions - Design solutions for complex engineering


problem and design system components or processes that needs the specified needs
with appropriate consideration for the public health and safety and the cultural,
societal and environmental consideration.
PO4: Conduct Investigation of Complex Problem - Use research-based knowledge
and research methods including design of experiments analysis and interpretation of
data, and synthesis of information to provide valid conclusions.

PO5: Modern Tool Usage - Create, select and apply appropriate techniques,
resources and modern engineering and IT tools, including prediction and modeling
to complex engineering activities with an understanding of the limitations.

PO6: The engineer and society - Apply reasoning informed by contextual


knowledge to assess societal, health, safety, legal and cultural
issues and the consequent responsibilities relevant to the professional
engineering practice.

PO7: Environment and sustainability - Understand the impact of the professional


engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.

PO8: Ethics - Apply ethical principles and commit to professional ethics and
responsibilities and norms of engineering practice.
PO9: Individual and Teamwork - Function effectively as an individual and as a
member or leader in diverse teams, and in multidisciplinary settings.

PO10: Communication - Communicate effectively on complex engineering


activities with the engineering community and with the society at large, such
as, being able to comprehend and write effective reports and design
documentation, make effective presentations, and give and receive clear
instructions.

PO11: Project management and finance - Demonstrate knowledge


and understanding
of the engineering and management principles and apply these to one’s own work, a
s a member and leader in a team to manage projects and
in multidisciplinary environments.

PO12: Life-long learning - Recognize the need for and have the preparation and
ability to engage in independent and life-long learning in the broadest context of
technological change.
PROGRAMSPECIFICOUTCOMES

Computer Science and Engineering graduates at

UNIVERSITY INSTITUE OF TECHNOLOGY , RGPV

will be able to:

PSO1: Professional Skills-The ability to understand, analyze and develop computer


programs in the areas related to algorithms, system software, multimedia, web
design, network security, IoT and networking for efficient design of computerbased
systems of varying.

PSO2: Problem-Solving Skills-The ability to apply standard practices and strategies


in software project development using open-ended programming environments to
deliver a quality product for business success.

PSO3: Successful Career and Entrepreneurship- The ability to employ modern


computer languages, environments, and platforms in creating innovative career
paths to be an entrepreneur, and a zest for higher studies.
University Institue Of
Technology,RGPV DEPARTMENT OF
COMPUTERSCIENCE AND
ENGINEERING

GENERAL LABORATORY INSTRUCTIONS

1. Students are advised to come to the laboratory at least 5 minutes


before (to starting time), those who come after 5 minutes will not
be allowed into the lab.

2. Plan your task properly much before to the commencement, come


prepared to the lab with the program / experiment details.

3. The student should enter into the laboratory with:


a. Laboratory observation notes with all the details (Problem
statement, Aim, Algorithm, Procedure, Program, Expected
Output, etc.,) filled in for the lab session.

b. Laboratory Record updated up to the last session


experiments.
c. Formal dresscode and Identitycard.

4. Sign in the laboratory login register, write the TIME-IN, and


occupy the computer system allotted to you by the faculty.

5. Execute your task in the laboratory, and record the results


/ output in the lab observation note book, and get certified by the
concerned faculty.
6. All the students should be polite and cooperative with the
laboratory staff, must maintain the discipline and decency in
laboratory.

7. Computer labs are established with sophisticated and high end


branded systems, which should be utilized properly.

8. Students / Faculty must keep their mobile phones in SWITCHED


OFF mode during the lab sessions. Misuse of the equipment,
misbehaviours with the staff and systems etc., will attract
severe punishment.

9. Students must take the permission of the faculty in case of any


urgency to go out. If anybody found loitering outside the lab / class
without permission during working hours will be treated seriously
and punished appropriately.

10. Students should SHUT DOWN the computer system before he/she
leaves the lab after completing the task (experiment) in all aspects.
He/she must ensure the system
/ seat is kept properly.
11.

Head of the Department Principal

University Institue Of
Technology,RGPV DEPARTMENT OF
COMPUTERSCIENCE AND
ENGINEERING

CODE OF CONDUCT FOR THE LABORATORY

• All students must observe the dress code while in the


laboratory
• Footwear is NOT allowed
• Foods, drinks and smoking are NOT allowed
• All bags must be left at the indicated place
• The lab timetable must be strictlyfollowed
• Be PUNCTUAL for your laboratorysession
• All programs must be completed within the given
time
• Noise must be kept to a minimum
• Workspace must be kept clean and tidy at all time
• All students are liable for any damage to system
due to their ownnegligence
• Students are strictly PROHIBITED from taking out
any items from the laboratory
• Report immediately to the lab programmer if any
damages to equipment

BEFORE LEAVING LAB:

• Arrange all the equipment and chairs properly.


• Turn off / shut downthe systems before leaving.
• Please check the laboratory notice board regularly
for updates.

Lab In – charge
Name of the experiment Date of Date of Remark’s
[Link] Experiment Submissio n
1. Demonstrate about fundamentals of python
programming with data types (i.e., int, float,
complex, bool and string types)
2. Write a python program to compute the GCD of two
numbers using python.

3. Write a python program to find the maximum of list


of numbers.

4. Demonstrate the following conditional statements in


python with suitable examples. I) if statement ii) if
else statement iii) if-elif-else statement
5. Demonstrate the following iterative statements in
python with suitable examples. I) while loop ii)

for loop
6. 6. Demonstrate the following control transfer
statements in python with suitable examples. I) break

ii) continue iii) pass.


7. Python program to perform read and write operations
on a file

8. Write a python program to multiply matrices using


python

9. Write a python program to sort list of elements using


insertion sort

10. Demonstrate the different ways of creating list objects


with suitable example programs

11. Write a code to implement merge sort in python.

12. Demonstrate inheritance in python.

13. Demonstrate file handling in python.


EXPERIMENT NO: 1

Aim:- Demonstrate about fundamentals of python programming with data


types (i.e., int, float, complex, bool and string types)

Code :
# int
a = 10
print("Integer:", a)

# float
b = 3.14
print("Floa t:", b)

#complex
c = 2+ 3j
print("Complex:", c)

#bool
d = True print("Boolean:", d)

#string \
e = "Hello, Python!"
print("String: ",
Output:

Integer:10
Float: 3.14
Complex: (2+3j)
Boolean:
True
String: Hello, Python!
EXPERIMENT NO: 2

AIM : Write a python program to compute the GCD of two numbers using
python

Code :
a = 60

b = 48

gcd = [Link](a, b)

print ( f"GCD of {a} and {b} is {gcd }")


Output:
GCD o f 60 and 4 8 is 1
EXPERIMENT NO : 3

AIM : Write a python program to find the maximum of list of numbers.

Code:

#Maximum in list

numbers = [10, 25, 5, 78,30]

maximum = max(numbers)

print("Maximum number is:", maximum)


Output:

Maximum number is: 78


EXPERIMENT NO: 4

AIM : Demonstrate the following conditional statements in python with


suitable examples.
I. if statement
II. if else statement
III. if-elif-else statement

Code:
x = 15

#if statement
if x > 10:
print("x is greater than 10")

#if-else
statement if x % 2 == 0:
print("x is even")
else:
print("x is odd")

# if-elif-else statement
if x < 0:
print("x is negative")
elif x == 0:
print("x is zero")
else:
print("x is positive")
Output:
x is greater
than 10
x is odd
x is positive
EXPERIMENT NO:5
AIM : Demonstrate the following iterative statements in python with
suitable examples.

I. while loop
II. for loop.

Code :
# while loop
i=1

while i <= 5:
print("While loop iteration:", i)
i += 1

# for loop
for j in range(1, 6):
print("For loop iteration:", j)
Output:
While loop iteration: 1
While loop iteration: 2
While loop iteration: 3
While loop iteration: 4
While loop iteration: 5
For loop iteration: 1
For loop iteration: 2
For loop iteration: 3
For loop iteration: 4
For loop iteration: 5
EXPERIMENT NO: 6

Aim :- 6. Demonstrate the following control transfer statements in python with


suitable examples.

i) break
ii) continue
iii) pass.

Code:
# break
for i in range(1,10):
if i ==5:
break
print("Break example:", i)

# continue
for i in range(1, 6):
if i ==3:
continue
print("Continue example:", i)

# pass
for i in range(1, 4):
if i == 2:
pass # does nothing
print("Pass example:", i)
Output:
Break example: 1
Break example: 2
Break example: 3
Break example: 4
Continue example: 1
Continue example: 2
Continue example: 4
Continue example: 5
Pass example: 1
Pass example: 2
Pass example: 3
EXPERIMENT NO : 7

Aim:- Python program to perform read and write operations on a file.

Code:

# Write to a file
with open("[Link]", "w") as file:

[Link]("Hello, file handling in Python!")

# Read from a file

with open("[Link]", "r") as file:


content = [Link]()
print("File content:", content)
Output:

File content: Hello, file handling in Python!


EXPERIMENT NO: 8

Aim:- Write a python program to multiply matrices using python.


Code:
A = [[1, 2], [3, 4]]
B = [[5, 6], [7, 8]]

result = [[0, 0], [0, 0]]

for i in range(len(A)):
for j in range(len(B[0])):
for k in range(len(B)):
result[i][j] += A[i][k] * B[k][j]

print("Product of matrices:")
for row in result:
print(row)
Output:

Product of matrices:
[19, 22]
[43, 50]
EXPERIMENT : 9

Aim:- Write a python program to sort list of elements using insertion sort.

Code:
arr = [12, 11, 13, 5, 6]

for i in range(1,
len(arr)): key = arr[i]
j=i-1
while j >= 0 and key < arr[j]:
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = key

print("Sorted array:", arr)


Output:

Sorted array: [5, 6, 11, 12, 13]


EXPERIMENT NO : 10

Aim:- Demonstrate the different ways of creating list objects with suitable
example programs

Code:
# Using []

list1 = [1, 2, 3]

print("List1:", list1)

# Using list() list2 = list((4, 5, 6))

print("List2:", list2)

#Using list comprehension

list3 = [x for x in range(7, 10)]

print("List3:",
Output:
List1: [1, 2, 3]
List2: [4, 5, 6]
List3: [7, 8 , 9]
EXPERIMENT NO :11
A

AIM:Write a code to implement merge sort in python.

CODE:
def merge_sort(arr):
if len(arr) > 1:
# Finding the mid of the array
mid = len(arr) // 2

# Dividing the array elements into 2 halves


L = arr[:mid]
R = arr[mid:]

# Sorting the first half


merge_sort(L)
# Sorting the second half
merge_sort(R)

i=j=k=0

# Copy data to temporary arrays L[] and R[]


while i < len(L) and j < len(R): if
L[i] < R[j]:
arr[k] = L[i] i += 1
else: arr[k] = R[j]
j += 1
k += 1

# Checking if any element was left in L[]


while i < len(L):
arr[k] = L[i]
i += 1 k += 1

# Test the merge sort


arr = [38, 27,43, 3, 9, 82, 10]
print("Original array:", arr)
merge_sort(arr) print("Sorted array:", arr)
Output:

Original array: [38, 27, 43, 3, 9, 82, 10]


Sorted array: [3, 9, 10, 27, 38, 43, 82]
EXPERIMENT NO: 12

AIM:- Demonstrate inheritance in python

Code :-
# Base class
class Animal:
def _init_(self,name):
[Link] = name

def speak(self):
print(f"{[Link]} makes a sound.")

# Derived class inheriting from Animal


class Dog(Animal):
def speak(self): print(f"{[Link]} barks.")

#Derived class inheriting from Animal


class Cat(Animal):
def speak(self): print(f"{[Link]} meows.")

# Creating objects animal = Animal("Generic Animal")


dog = Dog("Buddy")
cat = Cat("Whiskers")

# Calling methods
[Link]()
[Link]()
[Link]
Output:
Generic Animal makes a sound.
Buddy barks.
Whiskers meows.
EXPERIMENT NO: 13

Aim:- Demonstrate file handling in python.


Code :-
# File Handling in Python

# 1 Create a new file and write data to it


file = open("[Link]", "w") # 'w' mode creates a file for writing
[Link]("Hello, this is the first line.\n")
[Link]("This is the second line.\n")
[Link]()
print("File created and data written successfully.")

# 2 Read the contents of the file


file = open("[Link]", "r") # 'r' mode opens the file for reading
content = [Link]()
print("\nContents of the file:")
print(content) [Link]()

# 3 Append new data to the file


file = open("[Link]", "a") # 'a' mode opens the file for appending
[Link]("This is an appended line.\n")
\[Link]()
print("\nData appended successfully.")

# 4 Read the updated contents of the file


file = open("[Link]", "r")
content = [Link]()
print("\nUpdated contents of the file:")
print(content) [Link]()
Output: File created and data written
successfully.

Contents of the file:


Hello, this is the
first line. This is
the second line.

Data appended successfully.

Updated contents of the


file: Hello, this is the first
line.
This is the
second line. This
is an appended
line.

You might also like