Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S

NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)


Department of Computer Science & Engineering (CSE)
---------------------------------------------------------------------------------------------------------------------
Experiment No – 01

Write a Program to calculate the area of triangle, rectangle, and circle.

Problem Description: To understand this problem statement Python basic


knowledge required.

Problem Solution:

● Take input from user. Using input() function

● Find Area of Triangle, Rectangle and circle

● Calculate the values of respective

● Print the respective values

Practical Related Question

1. What is python? What are different applications of python


2. Write down syntax of “print ( )” statement.
3. How to take input from user
4. How to assign the variables in python

BTCOL406 : Python Programming 1 Prof. Vaibhavi Avachat


NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S
NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)
Department of Computer Science & Engineering (CSE)
---------------------------------------------------------------------------------------------------------------------
Experiment No – 02

To study the looping control statement and decision making statement with an
example.

2.1 Write a Python Program to calculate factorial of a number

Problem Description: To understand this problem statement Python basic


knowledge required.

Problem Solution

1. Start
2. Declare the variable n and read n value n = input(‘ enter the number ‘)
3. Initialize fact = 1 and i = 1
4. In while loop perform fact = fact * i
5. i = i + 1
6. print factorial of n
7. end

2.2 Write a Python Program to accept the marks of five subjects. Calculate
the percentage and display percentage with grade.

Problem Description: To understand Python basic knowledge and condition


statements requires.

Problem Solution

1. Start
2. Declare the variable required, input the subject marks
3. Calculate the percentage
4. Decide the grades and conditions
5. print the grade of respective students percentage
6. end

BTCOL406 : Python Programming 2 Prof. Vaibhavi Avachat


NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S
NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)
Department of Computer Science & Engineering (CSE)
---------------------------------------------------------------------------------------------------------------------
2.3 Write a Python Program to accept the number. Display reverse of number
and check number is palindrome or not Simple Calculator by Making
Functions.

Problem Description: To understand Python basic knowledge, condition


statements like while loop knowledge requires.

Problem Solution:

1. Start
2. Declare the variable n and read n
3. Assign n = k
4. Initialise r = 0
5. In a while, loop perform
a. d = n % 10
b. r = r * 10 + d
c. n = math.floor(n / 10)
d. check the condition r == k
i. If the condition is a true print that given number is a
palindrome
6. Otherwise print the given number is not a palindrome
7. end

Practical Related Question

1. Explain if _else statement with syntax.


2. Explain for loop with syntax and range function .
3. Explain ‘break’ and ‘continue’ statement
4. Write syntax for while loop

BTCOL406 : Python Programming 3 Prof. Vaibhavi Avachat


NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S
NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)
Department of Computer Science & Engineering (CSE)
---------------------------------------------------------------------------------------------------------------------
Experiment No – 03

Program to find the union of two lists.

Problem Description
The program takes two lists and finds the unions of the two lists.

Problem Solution
1. Define a function which accepts two lists and returns the union of them.
2. Declare two empty lists and initialise to an empty list.
3. Consider a for loop to accept values for two lists.
4. Take the number of elements in the list and store it in a variable.
5. Accept the values into the list using another for loop and insert into the list.
6. Repeat 4 and 5 for the second list also.
7. Find the union of the two lists.
8. Print the union.
9. Exit.

Practical Related Question

1. What is a List? Explain List methods, any 3


2. What is the difference between list and set?
3. What are different set operations?

BTCOL406 : Python Programming 4 Prof. Vaibhavi Avachat


NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S
NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)
Department of Computer Science & Engineering (CSE)
---------------------------------------------------------------------------------------------------------------------
Experiment No – 04

Program to find the intersection of two lists.

Problem Description
The program takes two lists and finds the intersection of the two lists.

Problem Solution
1. Define a function that accepts two lists and returns the intersection of them.
2. Declare two empty lists and initialize them to an empty list.
3. Consider a for loop to accept values for the two lists.
4. Take the number of elements in the list and store it in a variable.
5. Accept the values into the list using another for loop and insert into the list.
6. Repeat 4 and 5 for the second list also.
7. Find the intersection of the two lists.
8. Print the intersection.
9. Exit.

Practical Related Question

1. What is intersection?
2. What are the built-in types of python?
3. How to import modules in python?

BTCOL406 : Python Programming 5 Prof. Vaibhavi Avachat


NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S
NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)
Department of Computer Science & Engineering (CSE)
---------------------------------------------------------------------------------------------------------------------
Experiment No – 05

Program to remove the ―i‖ th occurrence of the given word in a list where
words repeat.

Problem Description

The program takes a list and removes the ith occurrence of the given word in
the list where words can repeat.

Problem Solution
1. Take the number of elements in the list and store it in a variable.

2. Accept the values into the list using a for loop and insert them into the list.

3. Use a for loop to traverse through the elements in the list.

4. Then use an if statement to check if the word to be removed matches the element
and the occurrence number and otherwise it appends the element to another list.

5. The number of repetitions along with the updated list and distinct elements is
printed.

6. Exit.

Practical Related Question

1. What are string and its different methods? Explain.


2. Explain different types of FOR Loop declarations
3. Syntax for loop with range.

4. What are different logical operators?

BTCOL406 : Python Programming 6 Prof. Vaibhavi Avachat


NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S
NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)
Department of Computer Science & Engineering (CSE)
---------------------------------------------------------------------------------------------------------------------
Experiment No – 06

Program to count the occurrences of each word in a given string sentence.

Problem Description
The program takes a string and counts the occurrence of each word in the given
sentence.

Problem Solution
1. Take a string and a word from the user and store it in separate variables.

2. Initialize a count variable to 0.

3. Split the string using space as the reference and store the words in a list.

4. Use a for loop to traverse through the words in the list and use an if statement to
check if the word in the list matches the word given by the user and increment the
count.

5. Print the total count of the variable.

6. Exit

Practical Related Question

1. List out string operations

2. How to calculate string length?

3. What is the default data type used in python?

4. What is difference between spit() and strips()

BTCOL406 : Python Programming 7 Prof. Vaibhavi Avachat

You might also like