Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in

Posted on

Python Function to check if a number is prime

def is_prime(num):
    Function to check if a number is prime
    for i in range(2, num):
        if num % i == 0:
            return False
    return True

def gen_primes(max_number):
    Function to generate prime numbers
    for num1 in range(2, max_number):
        if is_prime(num1):
            yield num1

def main():
    Main function

if __name__ == '__main__':
Enter fullscreen mode Exit fullscreen mode

Top comments (0)