0% found this document useful (0 votes)
4 views11 pages

FYBSc_Data_Science_Labbook

This lab manual is designed for the Advanced Python Programming Laboratory, containing 10 theory questions and 40 practical programming exercises. It serves as a journal for the final practical exam and is prepared by Mrs. Vividha Bahety, with guidance from the college's principal and vice-principal. The exercises cover a wide range of Python programming concepts, including control structures, data types, functions, and object-oriented programming.

Uploaded by

J.R PHYLM
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)
4 views11 pages

FYBSc_Data_Science_Labbook

This lab manual is designed for the Advanced Python Programming Laboratory, containing 10 theory questions and 40 practical programming exercises. It serves as a journal for the final practical exam and is prepared by Mrs. Vividha Bahety, with guidance from the college's principal and vice-principal. The exercises cover a wide range of Python programming concepts, including control structures, data types, functions, and object-oriented programming.

Uploaded by

J.R PHYLM
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
You are on page 1/ 11

FYBSc(Data Science)

DS- Computer Laboratory Based on


Problem solving using Python

Lab Manual

Name: _________________________________________________

Roll No.: _______ Academic Year: ___________________

Head of Department: Signature of internal faculty

Date: Signature of external faculty


PREFACE:

For the effective execution of Advanced Python Programming Laboratory


practical, this lab manual has been prepared. It contains 10 theory questions of
programming and 40 Practical questions.

This lab book will be considering as Journal for final practical exam.

PREPARED BY:

Mrs. Vividha Bahety, Indira College of Commerce and Science, Pune

REVIEWED BY:
Mrs. Divya Chitre, Indira College of Commerce and Science, Pune

UNDER THE GUIDANCE OF:

Dr. Janardan Pawar,


Principal, Indira College of Commerce and Science, Pune

Dr. Shivendu Bhushan ,


Vice-Principal, Indira College of Commerce and Science, Pune

2
Python Programming
Lab
Index

Sr.No. Question Assigned Remark


Date
1 a) Write a program to check if a number
is positive, negative, or zero.
b) Write a program to find the largest of
three numbers.
c) Write a program to check if a number
is even or odd.
2 a) Write a program to find the factorial of
a number using a while loop.
b) Write a program to print the first 10
natural numbers using a while loop.
c) Write a program to print all even
numbers between 1 and 50.

3 a) Write a program to find the sum of all


numbers in a given range.
b) Write a program to check if a given
year is a leap year.
c) Write a program to print the
multiplication table of a given number.
4 a) Write a program to count the number
of digits in a number.
b) Write a program to reverse a given
number.
c) Write a program to check if a given
number is a palindrome.

5 a) Write a program to find the sum of the


digits of a number.
b) Write a program to print all prime
numbers between 1 and 100.
c) Write a program to find the greatest
common divisor (GCD) of two
3
numbers.

6 a) Write a program to check if a given


string is a palindrome.
b) Write a program to print the Fibonacci
series up to a given number of terms.
c) Write a program to count the number
of vowels in a given string.
7 a) Write a program to find the sum of all
even numbers in a given list.
b) Write a program to check if a given
number is a perfect number
8 a) Write a python program to accept any
no. and find the count of even, odd &
zero digits within that number.
b) Write a python program to accept a
number and find the sum of 1st and last
digit of that number.
9 a) Write a python program to find the
sum of 1+2+3+4+..+n
b) Write a python program to accept a
number form user and find it’s
factorial.
c) Write a python program to accept a
number form user and print sum of
digits of a number.
10 a) Write a python program to print
REVERSE of a number.
b) Write a python program to accept a
number and find the sum of digits of
odd places of a given number.

11 a) Write a python program to check


whether given number is prime or not
b) Write a python program to swap two
numbers.
12 a) Write a python program to print
pattern
5
10 15
20 25 30
a) Write a python program to print sum

4
of 1/12+ 3/33 + 5/54 + .... + n/nn+1

13 a) Write a python program to calculate


the length of string without using
inbuilt function.
b) Write a python program to copy one
string into another string.

14 Write a Python program to add 'ing' at the


end of a given string (length should be at
least 3). If the given string already ends
with 'ing' then add 'ly' instead. If the string
length of the given string is less than 3,
leave it unchanged.
Sample Input: 'run'
Expected Output: 'runing'
Sample Input: : 'string'
Expected Output: : 'stringly'
15 a) Write a python program that accepts a
string from user and redisplays the
same string after removing vowels
from it.
b) Write a Python program to count
occurrences of character in a string.
16 Write a Python program to get a string
from a given string where all occurrences
of its first char have been changed to '$',
except the first char itself.
Sample Input: 'restart'
Expected Output: 'resta$t'
17 a) Write a Python program to get a string
made of the first 2 and the last 2 chars
from a given a string. If the string
length is less than 2, return instead of
the empty string.
Sample Input: 'Impetus'
Expected Output: 'Imus'
Sample Input: 'I'
Expected Output: Empty String
b) Write a Python program to concatenate
two strings in a third string. Do not use
+ operator.

5
18 Write a Python program to read a name
from the user and prints its abbreviated
form.
Sample Input: ‘Sachin Ramesh Tendulkar’
Expected Output: 'SRT

19 a) Write a python program to sum all


the elements in the list.
b) Write a python program to get the
largest and smallest number from the
list.

20 a) Write a Python program to print


the even numbers from a given
list.
b) Write a python program to search
element in the list.
21 Write a python program to create a set. add
element in the set. update elements in the
set. remove element from set. discard
element from set. check the element is
present in the set or not. find out length of a
set. clear a set
22 Given a tuple of strings, write a Python
program to:
 Concatenate all strings into a single
string.
 Count the number of occurrences of
a specific string in the tuple.
23 a) Create a tuple of numbers and write a
Python program to:
 Find the maximum and
minimum values in the tuple.
 Calculate the sum of all
elements in the tuple
b) Write a Python program that takes a
tuple of numbers and:
 Finds and prints the index of a
given element in the tuple.
 Checks if a particular number
exists in the tuple (use
membership operators like in
and not in).
6
24 a) Write a python program to create a
dictionary add an item in dictionary
remove an item from a dictionary and to
check if a given key already exists in a
dictionary.
25 a) Write a Python program that finds the
greatest of three given numbers using
functions. Pass the numbers as
arguments.
b) Write a Python program with
FUNCTION for sum of all the
numbers in the list.
26 a) Write a Python program that passes
lambda function as an argument to
another function to compute the cube
of a number.
b) Write a Python program using
function is perfect() that returns value
1 if the argument passed to it is a
perfect number and 0 otherwise.
27 a) Write a python program to that uses
lambda() to multiply two numbers.
b) Write a python program using
function that returns the result of
addition, subtraction, multiplication
and division
28 a) Write a python program to
understand the positional arguments
of a function
b) Write a python program to
understand the keyword arguments of
a function
29 a) Write a python program to SWAP
two variables that are defined as
Global variable.
b) Write a python program using
functions that returns the result of
addition, subtraction, multiplication
and division
30 Write a python program to define Student
class and create an object to it. Also create
and call the method to display the students
details

7
31 Write a python program to create bank
class where deposits and withdrawals can
be handled using instance method.

32 Write a python program to create a base


class Student(Roll No, Name) which
derives two classes Test (Mark1, Mark2)
and Sport(Score). Result(total marks,
grade) class inherits both Test and Sport
classes. Write a Python program to
Calculate total of marks and grade.

33 Write a python program to design a base


class customer(name, phone_no). Derive a
class depositor(acc_no, balance) from
customer. Again derive a class
borrower(loan_no, loan_amt) from
depositor. Write necessary member
functions to read and display the details of
a customer.

34 Write a Python program to pass values to


base class constructors in Hierarchical
inheritance. Assume suitable classes to
exhibit proper relationships.

35 Write a Python program to pass values to


base class constructors in Multilevel
inheritance. Assume suitable classes to
exhibit proper relationships.

36 Write a python program to call super class


constructor in the sub class using super()

8
37 Write a python program to showing single
inheritance in which two sub classes are
derived from a single base class

38 Write a python program to implement


multiple inheritance using two base classes

39 Write a python program to calculate the


gross salary and net salary of an
employee.
40 Create class Rectangle with attributes
length and width and methods area() to
calculate the area of the rectangle.
perimeter() to calculate the perimeter.
Creates an instance of Rectangle, sets its
length and width, and then calculates its
area and perimeter.
41 Create a class Employee with attributes:
name, age, and salary. Write a method
get_details() to return a string with the
employee's details. Then, write a method
to give a salary increment. Create at least
two objects and demonstrate their
functionality.
42 Create a class Student with attributes:
name, roll_number, marks (a list of marks
in different subjects) and methods
calculate_average() to calculate the
average marks, display_student_info() to
print the student's name, roll number, and
average marks. Create an object for a
student and display their information
along with the average marks.
43 Create a class Vehicle with attributes
make, model, and year. Define a method
start() that prints "Vehicle is starting".
Create a subclass ElectricCar that adds an
attribute battery_capacity and overrides
the start() method to print "Electric car is
starting silently". Create instances of both
Vehicle and ElectricCar to show how
method overriding works.
44 Define a base class Shape with a method
area() that returns 0. Create two
subclasses: Circle and Rectangle. In the
9
Circle class, override the area() method to
return the area of a circle (use πr²). In the
Rectangle class, override the area()
method to return the area of a rectangle
(length × width). Create objects of both
Circle and Rectangle, set their dimensions,
and display their areas.
45 Create a class Appliance with attributes:
brand and power with methods: A method
turn_on() that prints "Appliance is turning
on". Create a subclass WashingMachine
that inherits from Appliance and adds an
attribute load_capacity. Override the
turn_on() method in WashingMachine to
print "Washing machine is starting with X
kg load", where X is the load capacity.
Create an object of WashingMachine and
demonstrate both inheritance and method
overriding.

Name & Signature of Faculty In-charge:

Head of Department:

Date:

10
11

You might also like