Created
April 11, 2018 18:09
-
-
Save AndersonFirmino/b0300923094a5a8450018c5bd32c9de8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def odd_or_even(flag, limit): | |
"""Retorna um numero aleatorio pelo limite | |
:param flag: | |
:param limit: | |
:return: | |
""" | |
if flag: | |
return choice(sorted(filter(lambda x: x % 2 == 0, tuple(range(limit))), key=lambda x: random())) | |
return choice(sorted(filter(lambda x: x % 2 != 0, tuple(range(limit))), key=lambda x: random())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment