Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. # Paste your function here
  2. def applyF_filterG(L, f, g):
  3.     foundany = 1
  4.     #!Remove all fails
  5.     while foundany != 0:
  6.         foundany = 0
  7.         pos = 0
  8.         for i in L:
  9.             if type(i) != int:
  10.                 foundany = 1
  11.                 del L[pos]
  12.             else:
  13.                 integeri = int(i)
  14.                 integeri = int(f(integeri))
  15.                 integeribool = g(integeri)
  16.                 if integeribool == False and foundany == 0:
  17.                     foundany = 1
  18.                     del L[pos]
  19.             pos += 1
  20.     #!Return the goods
  21.     if len(L) == 0:
  22.         return -1
  23.     else:
  24.         return max(L)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement