How to work dis

IM trying to make a project that prints out the first 25 prime numbers but it doesn't work

Roar123 (427)

What is your technique for calculating primes? I wrote a quick program in Python3 to calculate this - you can use a similar technique.

```
# Python3
def prime_check(n):
# Creates list with factors and measures length
factor_len = len([i for i in range(1,n+1) if n % i == 0])
# Number with 2 factors is prime
if factor_len == 2:
return "Prime"
else:
pass
prime_list = []
number = 2
while len(prime_list) < 25:
prime = prime_check(number)
if prime == "Prime":
# Adding number to list if prime
prime_list.append(number)
else:
pass
number += 1
print(prime_list)
```

advaydhiraj (5)

@Roar123 thanks

Roar123 (427)

@advaydhiraj You're welcome! Were you able to understand the Python example? And also if I answered your question, you should mark my response as the answer.

advaydhiraj (5)

@Roar123 Sorry im new so i dont know how to work dis.

Roar123 (427)

@advaydhiraj That's fine

advaydhiraj (5)

Thanks for your help! I got it to work!

https://repl.it/@advaydhiraj/Something-Cool

ChezCoder (1467)

um u didn't call the function draw. you only declared it

ChezCoder (1467)

just write `draw()`

at the end of the code

You need to run multiple iterations of the prime number check stuff in your function; You need to make a loop where it runes the number of times you want. Here I have made a loop using your last if statement as an exit condition. https://repl.it/@MoltasDev/Something-Cool

@MoltasDev This only runs it 25 times and doesn't print out exactly 25 primes

@advaydhiraj Oh, my bad. Read the question wrong. Then just do a loop checking if the length of the prime number array is 25.

@MoltasDev Yeah, I figured out what you were trying to do so know if you check the mini iframe up top it should work.