Professional Documents
Culture Documents
Daffodil International University Summer 2021 Teacher Initial: AS
Daffodil International University Summer 2021 Teacher Initial: AS
[Student must either TYPE or HAND WRITE the answers in this template; In case needed just
write your detail on the paper using hand]
a)ans:
This python program using the for loop to print vowels in a string. We will take a user-
defined function to check and print if a string contains vowels.
Output is:
Enter any string: oop
New string is: ['p'] from oop
Deleted are: ['o', 'o']
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
Student ID: 201-15-13804
b)ans:
My ID is 201-15-13804.
My id last digit 4, now index will be 4
Code is:
sectionC= ["a","b","c","d","e"]
print(sectionC)
sectionD= ["f","g","h","i","j"]
print(sectionD)
sectionE= ["k","l","m","n","o"]
print(sectionE)
sectionG= ["p","q","r","s","t"]
print(sectionG)
Output is:
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
Student ID: 201-15-13804
a)ans:
Code is:
given = (input())
filter = given[1:len(given) - 1]
filter = filter.split(',')
filter = str(filter)
filter = filter.lower()
vowel = "aeiou"
number_of_char = 8
number_of_vowel = 8
for i in filter:
if 'a' <= i <= 'z':
number_of_char = number_of_char + 1
for v in vowel:
if v == i:
number_of_vowel = number_of_vowel + 1
elif '0' <= i <= '9':
number_of_char = number_of_char + 1
print("Number of Character:", number_of_char)
print("Number of Vowel:", number_of_vowel)
Output is:
Mehedi, Rangpur, 201-15-13804, DIU
Number of Character: 32
Number of Vowel: 14
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
Student ID: 201-15-13804
b)ans:
Code is:
Output is:
BangYooHoo
1
2
bang
4
YooHoo
bang
7
8
bang
YooHoo
11
bang
13
14
BangYooHoo
16
17
bang
19
YooHoo
bang
22
23
bang
YooHoo
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
Student ID: 201-15-13804
26
bang
28
29
BangYooHoo
31
32
bang
34
YooHoo
bang
37
38
bang
YooHoo
41
bang
43
44
BangYooHoo
46
47
bang
49
YooHoo
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
Student ID: 201-15-13804
c)ans:
Code is:
print("...............................")
print("Hall management system")
print("...............................")
room_avi = [501, 502, 503,504]
room_no = ["501A", "501B", "501C", "501D","502A", "502B", "502C", "502D",
"503A", "503B", "503C", "503D","504A", "504B", "504C", "504D"]
room = input()
if room not in room_no:
print("Room is unavilable for you")
sits = {"501":4, "502":4, "503":2, "504":4, }
Output is:
...............................
Hall management system
...............................
501
Room is unavilable for you
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.