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

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 มิ.ย. 2020
  • Python program to find all the prime numbers in the given range
    Blog / Source Code:
    www.vtupulse.com/python-progr...
    Tutorials:
    Machine Learning - • Machine Learning
    Big Data Analysis - • Big Data Analytics
    Data Science and Machine Learning - • Machine Learning
    Python Tutorial - • Python Application Pro...
    Interview Preparation:
    Find the output of C Program - • #1 Find the Output, C ...
    Scholarship: • Step-2: How to upload ...
    VTU Updates: • VTU Update | Reopening...
    Blog / Website: www.vtupulse.com/
    Like Facebook Page: / vtupulse
    Follow us on Instagram: / vtupulse
    Like, Share, Subscribe and Don't forget to press bell ICON
    prime number in range in python,
    python program for prime numbers from 1 to 100,
    how to find number is prime,
    how to find a number is prime or not shortcut,
    program to find a number is prime or not,
    python program to find whether a number is prime or not,
    python program to find whether a number is prime,
    prime number program in python,
    prime number program in python using function,
    prime number program in python using for loop,
    python interview programs,
    python tutorial,
    technical interview questions in python,
    most commonly asked interview questions,
    programming questions answered,
    c technical interview questions and answers,
    interview programs in c,
    interview programs in c++,
    c aptitude interview questions,
    c programs,
    python programming,
    python programs,
    most commonly asked programs in interview,
    Java interview programs,
    company based technical programs,
    pattern programs

ความคิดเห็น • 39

  • @gattri87
    @gattri87 3 ปีที่แล้ว +16

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

  • @garvgoel1743
    @garvgoel1743 2 ปีที่แล้ว +3

    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}"

  • @devipriyaprasannakumar4100
    @devipriyaprasannakumar4100 หลายเดือนก่อน +1

    very well explained..thankyou so much

    • @MaheshHuddar
      @MaheshHuddar  หลายเดือนก่อน +1

      Welcome
      Do like share and subscribe

  • @Swamy84682
    @Swamy84682 ปีที่แล้ว +3

    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?

  • @ranjithv133
    @ranjithv133 3 ปีที่แล้ว +14

    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)

    • @DanyalShabirr
      @DanyalShabirr 2 ปีที่แล้ว

      This aint complex yet it lacks some statements.

  • @sarlengunavathy
    @sarlengunavathy 3 ปีที่แล้ว +1

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

  • @musaddiqali1
    @musaddiqali1 3 ปีที่แล้ว +5

    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?

  • @Aryansingh-fk7hy
    @Aryansingh-fk7hy 2 ปีที่แล้ว

    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!!.

  • @bhaskarcherry2196
    @bhaskarcherry2196 3 ปีที่แล้ว +3

    Non prime numbers how to print

  • @tanmayraut4654
    @tanmayraut4654 3 ปีที่แล้ว +3

    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

  • @IamHariJags
    @IamHariJags 3 ปีที่แล้ว

    i want the next prime number to be printed plz help

  • @ishanknaithani5610
    @ishanknaithani5610 ปีที่แล้ว

    Thank you sir
    ..

    • @MaheshHuddar
      @MaheshHuddar  ปีที่แล้ว

      Welcome
      Do like share and subscribe

  • @allenjr4978
    @allenjr4978 3 ปีที่แล้ว

    Sir what if the start value is 2

  • @prittamrahul3865
    @prittamrahul3865 ปีที่แล้ว

    Thank you sir ji

    • @MaheshHuddar
      @MaheshHuddar  ปีที่แล้ว

      Welcome
      Do like share and subscribe

  • @Simasofa
    @Simasofa ปีที่แล้ว

    Great

    • @MaheshHuddar
      @MaheshHuddar  ปีที่แล้ว

      Thank You
      Do like share and subscribe

  • @bodyart1460
    @bodyart1460 ปีที่แล้ว

    thank you

    • @MaheshHuddar
      @MaheshHuddar  ปีที่แล้ว

      Welcome
      Do like share and subscribe

  • @SQLpythonforeveryone
    @SQLpythonforeveryone ปีที่แล้ว

    so simple

    • @MaheshHuddar
      @MaheshHuddar  ปีที่แล้ว

      Thank You
      Do like share and subscribe

  • @sangbala9201
    @sangbala9201 3 ปีที่แล้ว

    I want comma in between numbers. What can I do

    • @sangbala9201
      @sangbala9201 3 ปีที่แล้ว

      Thank you

    • @garvgoel1743
      @garvgoel1743 2 ปีที่แล้ว

      ",".join(myList)
      myList is your list of all numbers

  • @tasharomanoff9284
    @tasharomanoff9284 3 ปีที่แล้ว +2

    What is meant by flag=0?

    • @mika4444
      @mika4444 3 ปีที่แล้ว

      i also want to know

    • @harvirreturn
      @harvirreturn 3 ปีที่แล้ว +1

      means they are prime number

  • @mika4444
    @mika4444 3 ปีที่แล้ว

    why is my program not working??!!

  • @dineshvirat130
    @dineshvirat130 3 ปีที่แล้ว

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

    • @naresh_kumar
      @naresh_kumar 3 ปีที่แล้ว

      get the range from user , :
      so only we are using that input step on start and end point

  • @rithickdharmaraj3619
    @rithickdharmaraj3619 3 ปีที่แล้ว +2

    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 ) ...

    • @harshkumaryadav
      @harshkumaryadav 3 ปีที่แล้ว

      Prime number ka definition pta bhi h ki nhi

  • @BMXRaghvendraSingh
    @BMXRaghvendraSingh 3 ปีที่แล้ว

    🥺

  • @sjr5194
    @sjr5194 3 ปีที่แล้ว

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

    • @sjr5194
      @sjr5194 3 ปีที่แล้ว

      @@MaheshHuddar thnq sir for replying to me.....I will wait for your video

    • @sjr5194
      @sjr5194 3 ปีที่แล้ว

      @@MaheshHuddar sir ...did you uploaded the video