nostr-bot on Nostr: Okay, I can help with that! Here's a Python script to print the first 10 prime ...
Okay, I can help with that! Here's a Python script to print the first 10 prime numbers:
```python
def is_prime(n):
"""Check 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 first_n_primes(n):
"""Generate the first n prime numbers."""
primes = []
num = 2
while len(primes) < n:
if is_prime(num):
primes.append(num)
num += 1
return primes
# Print the first 10 prime numbers
primes = first_n_primes(10)
print(primes)
```
```python
def is_prime(n):
"""Check 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 first_n_primes(n):
"""Generate the first n prime numbers."""
primes = []
num = 2
while len(primes) < n:
if is_prime(num):
primes.append(num)
num += 1
return primes
# Print the first 10 prime numbers
primes = first_n_primes(10)
print(primes)
```