Skip to content

Generate random boolean value in Python

Advertisements
import random


# Generate a random boolean.
def random_boolean():
    return random.choice([True, False])


def main():
    # Generate a random boolean.
    print(random_boolean())


main()

See also  PHP code snippet - How to get local current time in laravel?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.