This guide will cover finding prime numbers less than 100 in the python programming language. A complete explanation of the code is also provided in this guide. Let’s begin!

## Code:

```
# function to check if a number is prime
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
# loop to find all prime numbers less than 100
primes = []
for i in range(2, 100):
if is_prime(i):
primes.append(i)
# print the list of primes
print(primes)
```

## Output:

## Code Explanation:

here’s an explanation of the code in bullet points:

- Define a function
`is_prime`

that takes a number as input and returns`True`

if it’s prime, and`False`

otherwise.- Check if the number is less than or equal to 1 (which is not prime), and return
`False`

if it is. - Loop through all the numbers from 2 to the square root of the number (using the
`int(n**0.5)`

notation). - If any of these numbers divides the input number evenly, return
`False`

. Otherwise, return`True`

.

- Check if the number is less than or equal to 1 (which is not prime), and return
- Create an empty list
`primes`

to store the prime numbers found. - Loop through all the numbers from 2 to 99 (inclusive).
- For each number, check if it’s prime using the
`is_prime`

function. - If it’s prime, add it to the
`primes`

list using the`append`

method.

- For each number, check if it’s prime using the
- Print the list of prime numbers found using the
`print`

function.