Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fin = open("1.txt", "r")
- fout = open("2.txt", "w")
- text = fin.read()
- allpeaks = list()
- for item in text:
- if item != ' ' and item != '\n':
- allpeaks.append(int(item))
- #all peaks with no isolated
- #print(set(allpeaks))
- #all peaks like pairs
- lines = text.split("\n")
- print("lines or how many ties: ", len(lines))
- peaks = list()
- for line in lines:
- peaks = []
- peaks = line.split()
- #print(peaks)
- #find isolated
- isolated = []
- for i in range(1, 7):
- if i not in allpeaks:
- isolated.append(i)
- print("isolated peaks: ", isolated)
- #find stepen for all peaks separately
- a = list()
- a = (len(set(allpeaks))+1) * [0]
- print(a)
- for peak in allpeaks:
- a[peak] = a[peak] + 1
- print(a)
- print("Max peak: ", max(a))
- max = max(a);
- maxpeak = list()
- for i in range(1, len(a)):
- if a[i] == max:
- maxpeak.append(i)
- print(maxpeak)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement