-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWipro solved.py
52 lines (46 loc) · 1.23 KB
/
Wipro solved.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# find combinations of DNA sequences
nodna = int(input())
samples = str(input()).split()
divisions = int(input())
samples = str(input()).split()
divisions = int(input())
resultdna = [''.join(samples[i:i+divisions]) for i in range(0, len(samples), divisions)]
print(resultdna)
# Number of ommitted special characters
NAME = list(str(input()))
omit = []
for x in NAME:
if x.isalpha():
omit.append(x)
elif x.isnumeric():
omit.append(x)
elif x == " ":
omit.append(x)
print(len(NAME) - len(omit))
# kth smallest number
n = int(input())
lis = str(input()).split()
neg = int(input())
lis = [int(x) for x in lis]
for x in range(neg-1):
lis.remove(min(lis))
print(min(lis))
# split in pairs and remove smallest, keep singles
stre = list(str(input()))
increasing_slices = 0
sliced = []
result = []
for i in range(len(stre)):
increasing_slices += 2
sliced.append("".join(stre[increasing_slices-2:increasing_slices]))
for j in sliced:
if len(j) == 1 and j.isnumeric():
result.append(j)
elif len(j) == 2:
if j[0] > j[1]:
result.append(j[0])
elif j[1] > j[0]:
result.append(j[1])
elif j[1] == j[0]:
result.append(j[1])
print(''.join(result))