Python program to find all the prime numbers in the given range- by Mahesh Huddar

Python program to find all the prime numbers in the given range- by Mahesh Huddar

Mahesh Huddar

4 года назад

116,078 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@Simasofa
@Simasofa - 10.06.2023 19:44

Great

Ответить
@medacherishma6761
@medacherishma6761 - 02.05.2023 16:13

Sir,in the code,why can't we give break statement immediately after if (i%j==0) is true.Why do we need to include flag=1?

Ответить
@ishanknaithani5610
@ishanknaithani5610 - 28.02.2023 11:36

Thank you sir





..

Ответить
@bodyart1460
@bodyart1460 - 10.02.2023 09:06

thank you

Ответить
@SQLpythonforeveryone
@SQLpythonforeveryone - 08.12.2022 21:38

so simple

Ответить
@prittamrahul3865
@prittamrahul3865 - 28.11.2022 10:54

Thank you sir ji

Ответить
@garvgoel1743
@garvgoel1743 - 15.05.2022 08:53

def count_primes(initial,final):
numberOfPrimes=0
for _ in range(initial,final+1):
if _==1:
continue
if _ in [2,3,5,7] or (_%2 !=0 and _%3 !=0 and _%5 !=0 and _%7 !=0):
print(_)
numberOfPrimes +=1
return f"No. of prime numbers are {numberOfPrimes}"

Ответить
@Aryansingh-fk7hy
@Aryansingh-fk7hy - 25.08.2021 20:38

I am even getting 0 or 1 while initializing the start variable with the value 0 or 1 as per the given code in the video, as both are not prime numbers ,so the code is missing some statements,so please rectify that!!.

Ответить
@gattri87
@gattri87 - 03.07.2021 15:57

start is taken from 1, it also includes 1 but 1 is not a prime number

Ответить
@allenjr4978
@allenjr4978 - 21.06.2021 15:54

Sir what if the start value is 2

Ответить
@tanmayraut4654
@tanmayraut4654 - 07.06.2021 12:37

How do I print prime numbers from 1 to 1000, in group of 10's? like 2,3,5,7,11,13,17,19,23,29, then another 10 prime numbers….in python

Ответить
@rithickdharmaraj3619
@rithickdharmaraj3619 - 20.05.2021 21:59

Boss ,I need help .. my starting is 14 and ending is 16,,, there is no output .... But I need output as (no prime between the range ) ...

Ответить
@ranjithv133
@ranjithv133 - 11.05.2021 15:48

this is too complex . Try this instead

n=int(input('enter the number range'))
for i in range(2,n+1,1):
for j in range(2,i,1):
if i%j==0:
break
else:
print(i)

Ответить
@sjr5194
@sjr5194 - 06.05.2021 17:31

How to sum all the prime numbers what will we get in results

Ответить
@sarlengunavathy
@sarlengunavathy - 08.04.2021 06:09

I want the code to show the available prime numbers, the number of prime numbers and the sum of all prime numbers

Ответить
@bhaskarcherry2196
@bhaskarcherry2196 - 07.04.2021 08:16

Non prime numbers how to print

Ответить
@musaddiqali1
@musaddiqali1 - 24.03.2021 17:38

When the interval from start to end is very large, like in lakhs of numbers, then this program will take more time to compute. In that case, I came to know that the fastest method may be Sieve Of Eratosthenes method. Can you please explain this same program using Sieve of Eratosthenes method?

Ответить
@BMXRaghvendraSingh
@BMXRaghvendraSingh - 22.03.2021 05:54

🥺

Ответить
@mika4444
@mika4444 - 05.03.2021 19:48

why is my program not working??!!

Ответить
@tasharomanoff9284
@tasharomanoff9284 - 12.12.2020 14:12

What is meant by flag=0?

Ответить
@IamHariJags
@IamHariJags - 24.11.2020 16:58

i want the next prime number to be printed plz help

Ответить
@sangbala9201
@sangbala9201 - 17.10.2020 11:08

I want comma in between numbers. What can I do

Ответить
@dineshvirat130
@dineshvirat130 - 09.10.2020 08:35

(Get the range from the user)... Whats the range?

Ответить