Python Program to Print all Prime Numbers in an Interval - Complete Tutorial

preview_player
Показать описание


WsCube Tech is a leading Web, Mobile App & Digital Marketing company, and institute in India.

We help businesses of all sizes to build their online presence, grow their business, and reach new heights.

All the courses are job-oriented, up-to-date with the latest algorithms and modules, fully practical, and provide you hands-on projects.

📞 For more info about the courses, call us: +91-7878985501, +91-9269698122

✅ CONNECT WITH THE FOUNDER (Mr. Kushagra Bhatia) -

Connect with WsCube Tech on social media for the latest offers, promos, job vacancies, and much more:

--------------------------------------| Thanks |---------------------------
#pythonprograms #pythonprogramming
Рекомендации по теме
Комментарии
Автор

😎Hey, thanks for watching! We’d love to know your thoughts/doubts here in the comments.

wscubetech
Автор

More explanation is needed as to how the value continues to be

vaibhavv
Автор

why 2 is consider as a prime number? because when 2 going to second for loop it is range of (2, 2) than it check 2%2 that is equal to 0 than that is not a prime number. the solution is : find_p = range(1, 101)
for p in find_p:
if p > 1:
for x in range(2, int(p**0.5) + 1):
if p % x == 0:
break
else:
print(p)

PythonProjectSolver
Автор

mam I have a question. If I try to print else: statement with a tab space, right under second if, it prints the prime number more times than one. But when I write it like you have, behind the if: statement, it prints correctly. Isn't it necessary to use else: directly under if: statement. Please let me know. Thanks!

dawood
Автор

start=int(input("enter starting no:"))
end=int(input("enter ending no:"))
num=0
for num in range(2, end):
for i in range(2, num):
if num%i==0:
break;
else:
print(num)

Picture_of_truth
Автор

this is my code yet i am not getting the correct output:
a=int(input("a: "))
# b=int(input("b: "))
# num=0
# for num in range (a, b+1):
# if num>1:
# for i in range(2, num):
# if num%i==0:
# break
# else:
# print(num)

swastikpanda
Автор

Ma'am prime number repeated in output.

ArtiKumari-rblj
Автор

Code is not working...
Expexted indented block saying... irritating

ashsaha
Автор

Reach native ka full course upload kro please

mohammadajharuddeen
Автор

Mam we are using num here but we are not defined num then how your output will come

mekalachinnikrishna
Автор

Mai es video par pahli baar aaya hu or Python learn karna chahta hu. Kya hum Python me koi app devlop kar sakte hai ?

Kya hum Python se online tool bana sakte hai ?

Can you guide me god bless you 🙏🙏🙏🌸🌸

skcreates
Автор

i%j==0. Ie... 2%2==0.... thats right? Then how 2 printed in prime

thangutabbycat
Автор

hey i printed "num+1 " at the place of "num", and not getting the "2" in output as a prime number l=int(input("lower limit: "))
u=int(input("upperr limit: "))
for num in range(l, u+1):
if num>1:
for i in range(2, num+1):
if num%i==0:
break
else:
print(num)
break
this is my code

ichchakushwaha