Professional Documents
Culture Documents
Python
October 8, 2021
Faculty Team of FALL2021-22 – BCSE101E
Authored by:
For example
Input:
s1=”mask”
s2=”ask”
SearchPosition=0
Output:
FoundPosition=1.
[M6_CSQ2] Develop a program using function to solve a classic ancient puzzle. We count
m heads and n legs among chickens and rabbits in a farm. How many rabbits (x) and chickens
(y) do we have? If m and n are 35 and 94, then the x and y will be 12 and 23. [CO2] [L1]
For example:
Input:
35
94
1
Output:
12
23
[M6_CSQ3] Design a python program to list the students’ name who secured
For example, if the input is {‘siva’: 40, ‘kumar’:60, ‘arun’:80}, then the output is,
kumar
arun
2
[M6_CSQ4] Write a python program to generate a quiz using two files, named Questions.txt
and Answers.txt. The program opens Questions.txt and displays the question with options
on the screen. The program will verify the Answer.txt file and display the scores. [CO2] [L1]
1.A
2.B
[M6_CSQ5] Write a python program that defines a user defined function called frequency ()
which identifies and count the frequency of occurrences of the words in a given sentence
that is passed to the user defined function. The frequency occurrences of the word should
be returned in sorted order by words in the string. [CO2] [L1]
For Example:
Input:
Sentence = “It is true for all that that that that refers to is not the same that that that to refers
to “
Output:-
3
It:1
all:1
for:1
is:2
not:1
refers:2
same:1
that:7
the:1
to:3
true:1
4
[HoT Question]
Design a python program that merges two files and write the results to new file (THREE.txt).
The merge operation should take place line by line. The first line of the merged file should
contain the first line of TWO.txt and the second line of the merged file should contain the
first line of the ONE.txt.
For Example:- The content of ONE.txt and TWO.txt are input and the content of THREE.txt is
the output.
Input:-
Output:
case=1
input= This is same as C Programming language used to do more
complex problem.
Usually a file is kept on a permanent storage media, e.g. a hard
drive disk.
BCSE101E - Computer Programming: Python
5
A file or a computer file is a chunk of logically related data or
information which can be used by computer programs. Usually a file
is kept on a permanent storage media, e.g. a hard drive disk.
output =
A file or a computer file is a chunk of logically related data or
information which can be used by computer programs. This is a
Simple Programming language used to do more complex problem.
Usually a file is kept on a permanent storage media, e.g. a hard drive
disk. Yes, This is Not a very Simple Programming language but used
to solve more simple to complex problem.
6
BCSE101E – Module 7
[M7_CSQ1] Write a NumPy program to compute the mean, standard deviation, and
variance of a given array along the second axis. [CO2] [L1]
[M7_CSQ2] Create a NumPy program to create a structured array from given student
name, height, class and their data types. Now sort by class, then height if class are equal.
[CO2] [L1]
[M7_CSQ3] Develop a NumPy program to sort the student id with increasing height of the
students from given students id and height. Print the integer indices that describes the sort
order by multiple columns and the sorted data. [CO2] [L1]
[M7_CSQ4] Design a Pandas program to join the two given data frames along rows and
assign all data. [CO2] [L1]
[M7_CSQ5] Write a Pandas program to convert all the string values to upper, lower cases
in a given pandas series. Also find the length of the string values. [CO2] [L1]
• Current date.