-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq50.py
More file actions
24 lines (18 loc) · 741 Bytes
/
q50.py
File metadata and controls
24 lines (18 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
f = open("rosalind_ba9j.txt","r") #extracting the
inputv = f.read().strip()
burrows = [i for i in inputv]
sortedburrows = sorted(burrows)
def prepend(str1,str2): #prepending burrows to sortedburrows.
c = [str1[k] + str2[k] for k in range(0,len(burrows))]
return c
def prepsort(x,y): #performing the prepending and sorting.
str3 = prepend(x,y)
str3.sort()
return str3
sortedburrows = prepsort(burrows, sortedburrows) #determing the final result.
for i in range (0,len(burrows)-2):
sortedburrows = prepsort(burrows, sortedburrows)
for i in range(0,len(sortedburrows)):
if sortedburrows[i][-1] == '$':
result = sortedburrows[i]
print result