+ 2
Sum of first 10 prime numbers i given range using python
help me solve out this. first find the prime numbers in n given range then sum of first 10 prime numbers
3 odpowiedzi
+ 2
First do a for loop that runs through every number in range of input. Inside the for loop check for every number if it is prime by running a new function. In this function you can check if it's prime by getting all the dividors and then checking if the length of all dividors is 2. Then store all the primes in one list and run sum() on it.
https://code.sololearn.com/c8VmCTEj1S4H/?ref=app
+ 2
Also a bit shortened code here
https://code.sololearn.com/cNCyG6IbHkg5/?ref=app
+ 1
but this display only prime numbers .. no addition. but first one is ok