STANAANDREY

generateList

Oct 22nd, 2022 (edited)
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. def generateList(isOk, start, end):
  2.     if start > end:
  3.         return []
  4.  
  5.     if isOk(start):
  6.         return [start] + generateList(isOk, start + 1, end)
  7.  
  8.     return generateList(isOk, start + 1, end)
  9.  
  10.  
  11. a = int(input("a="))
  12. b = int(input("b="))
  13. print(generateList(lambda x: x % 7 == 0, a, b))
  14.  
Add Comment
Please, Sign In to add comment