Code editor
When you need to write code quickly!
def is_prime(n): """Checks if a number is prime.""" if n <= 1: return False for i in range(2, int(n**0.5) + 1): if n % i == 0: return False return True def prime_numbers(limit): """Returns a list of prime numbers up to a given limit.""" primes = [] for num in range(2, limit + 1): if is_prime(num): primes.append(num) return primes # Example of use if __name__ == "__main__": limit = 100 # Set the limit primes = prime_numbers(limit) print(f"Prime numbers up to {limit}: {primes}")