I
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
KAKATIYA INSTITUTE OF TECHNOLOGY & SCIENCE, WARANGAL
(An Autonomous Institute under Kakatiya University, Warangal)
Tutorial1 (T3)
(UNIT – I)
Course Code-Name U18CS506–Python Branch-SEM-Section 5CSE
Programming
Tutorial Sheet posted on 31.07.25 Tutorial class scheduled 06.08.2025
Course Web on on
Topics Covered Programming elements of python.
Max. Marks: 10
Tutor Q.
Answer the following questions. CO CDLL
ial No
Find the sqrt of a number using by importing Math module in python? [R]
1. Find the sqrt of a number using by importing cmath module in python? [R] CO 1 [An]
Use the sqrt function by importing [Link] [U]
write a program and evaluate the ouput with the above mentioned
two modules? [Ap]
Hint:
Import statement:
from [Link] import *
Evaluate the difference in ouputs? [An]
T3 The SciPy package includes the features of the NumPy package in Python.
It uses NumPy arrays as the fundamental data structure. It has all the
features included in the linear algebra of the NumPy module and some
extended functionality. It consists of a linalg submodule, and there is an
overlap in the functionality provided by the SciPy and NumPy
2. submodules. [R] CO 1 [An]
The [Link] function is used to solve the given linear equations. It is
used to evaluate the equations automatically and find the values of the
unknown variables. [U]
Let’s consider an example where two arrays a and b are taken by the
[Link] function. Array a contains the coefficients of the unknown
variables while Array b contains the right-hand-side value of the linear
equation. The linear equation is solved by the function to determine the
value of the unknown variables. [Ap]
Suppose the linear equations are:
7x + 2y = 8
4x + 5y = 10
[R]
[Ap]
[U]
[Ap]
[Ap]
Entry·in·row:·1·column:·4
0
Entry·in·row:·1·column:·5
1
Entry·in·row:·2·column:·1
1
Entry·in·row:·2·column:·2
1
Entry·in·row:·2·column:·3
56
Entry·in·row:·2·column:·4
23
Entry·in·row:·2·column:·5
0
Entry·in·row:·3·column:·1
1
Entry·in·row:·3·column:·2
0
Entry·in·row:·3·column:·3
0
Entry·in·row:·3·column:·4
8
Entry·in·row:·3·column:·5
5
The·given·matrix·is:·
1·0·1·0·1·
1·1·56·23·0·
1·0·0·8·5·
NO
Test Case 2:
Expected Output:
Enter·the·order·of·matrix·N·and·M·separated·by·space:· 2 6
Enter·values·for·matrix:·
Entry·in·row:·1·column:·1
1
Entry·in·row:·1·column:·2
0
Entry·in·row:·1·column:·3
1
Entry·in·row:·1·column:·4
0
Entry·in·row:·1·column:·5
0
Entry·in·row:·1·column:·6
0
Entry·in·row:·2·column:·1
0
Entry·in·row:·2·column:·2
1
Entry·in·row:·2·column:·3
0
Entry·in·row:·2·column:·4
1
Entry·in·row:·2·column:·5
1
Entry·in·row:·2·column:·6
0
The·given·matrix·is:·
1·0·1·0·0·0·
0·1·0·1·1·0·
YES
6.
Programs/how many holes are in a given text
Let us assume paper as the plane and a letter as a curve on the
plane, then each letter divides the plane into regions. [R]
For example letters A, D, O, P, R divide the plane into two regions
so we say these letters each have one hole. Similarly, the letter B
has two holes and letters such as C, E, F, K have no holes. The
number of holes in the text is equal to the total number of holes
in the letters of the text. [U]
Write a program to determine how many holes are present in a
given text. [Ap]
Constraints:
1. The input string contains only uppercase letters of the
English alphabet.
Sample Test Cases
Test Case 1:
Expected Output:
Enter·non-
empty·text·composed·only·of·uppercase·letters·of·English·alphabe
5
Test Case 2:
Expected Output:
Enter·non-empty·text·composed·only·of·uppercase·letters·of·Engli
2
Test Case 3:
Expected Output:
Enter·non-
empty·text·composed·only·of·uppercase·letters·of·English·alphabe
1
****
Prepared By :
Dr. Md. Sharfuddin Waseem