
Python Proctored Assessment Programming solution 2nd march
​
​
Question 1
GIVEN some strings in that we need to print the strings which doesn't contain vowels in it..
​
input 1:
​
4
avoid
ball
ntng
nani
output 1:
ntng
​
input 2:
3
avoid
ball
cat
ouput 2:
no values
​
​
Solution:
​
n=int(input())
l=[]
vow=['a','e','i','o','u']
for i in range(n):
l.append(input())
pre=[]
for j in range(n):
for i in range(len(l[i])):
if(l[i][j] in vow):
pre.append(l[i])
pre=list(set(pre))
if(len(pre)==len(l)):
print("no values")
else:
for i in range(n):
if(l[i] in pre):
pass
else:
print(l[i])
​
Question 2
​
Given passenger ID name gender distance
In last two lines they provide the passenger ID and discount percentage
We need to print the discount to be given for that particular passenger if that given Id is not in the list print no name or no value
​
input :
​
4
101
a
f
10000
102
b
m
12000
103
c
f
45000
104
d
m
65000
101
5
output:
discount of 101 is: 500.0
​
Solution 1(without class):
​
n=int(input())
k=[]
for i in range(n):
l=[]
l.append(input())
l.append(input())
l.append(input())
l.append(int(input()))
k.append(l)
key=input()
dis=int(input())
z=[]
for ind in range(n):
if(key==k[ind][0]):
z.append(ind)
if(len(z)==0):
print("no id found")
else:
i=z[0]
disc=k[i][3]*dis/100
if(disc>0):
print('discount of',k[i][0],'is:',disc)
else:
print(k[i][0],'is not eligible for discount')
Solution 2(with class):