Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_strongest_eggs(*args):
- count = args[-1]
- egg = [x for x in args[0]]
- f = []
- s = []
- strong_eggs = []
- if count == 2:
- for i in range(0, len(egg)):
- if i % 2 == 0:
- s.append(egg[i])
- else:
- f.append(egg[i])
- for i in range(0, len(f)-1):
- if i == 0:
- pass
- else:
- if (f[i] > f[i-1]) and (f[i] > f[i+1]) and (f[i+1] > f[i-1]):
- strong_eggs.append(f[i])
- for i in range(0, len(s)-1):
- if i == 0:
- pass
- else:
- if (s[i] > s[i-1]) and (s[i] > s[i+1]) and (s[i+1] > s[i-1]):
- strong_eggs.append(s[i])
- if count == 1:
- for i in range(1, len(egg)-1):
- if (egg[i] > egg[i-1]) and (egg[i] > egg[i+1]) and (egg[i+1] > egg[i-1]):
- strong_eggs.append(egg[i])
- return sorted(strong_eggs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement