Python Tutorial - Prime Numbers | Program To Check Entered Number is Prime or Not

  Рет қаралды 177,291

Amulya's Academy

Amulya's Academy

Күн бұрын

Пікірлер: 242
@manishbaburaisingh1985
@manishbaburaisingh1985 6 жыл бұрын
Simple and good .need more videos on the programs which are general in interviews
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Sure:) Thank you:)
@SriOonchamaratuKaruppanar01
@SriOonchamaratuKaruppanar01 4 ай бұрын
Yeah, yeah ,yeah😂😂😂
@priyankavaidya110
@priyankavaidya110 4 жыл бұрын
Thank you so much for explaining with example. I was confused with for loop. Now ,it is completely clear to me ....how it works.
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Glad it was helpful! :)
@abhishekpani6735
@abhishekpani6735 3 жыл бұрын
Thanku so much .. it really helped me...❤️
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Glad to hear that :)
@Joshi_Vibes
@Joshi_Vibes 4 жыл бұрын
after watching so mny videos i understood from yours ty:-):-)
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Glad to hear that :)
@Engineer9060
@Engineer9060 2 жыл бұрын
how you understood tell me also its totally wrong code ,it is for even no. when you will do it for 21 it will show prime but 21 is not prime....
@hmx21
@hmx21 3 жыл бұрын
You don't need to check all the way till num, running the loop till num//2 would get you the same result.
@DrRCB
@DrRCB 3 жыл бұрын
yes. However there is still a shorter range than n/2.
@okechukwuerinne2039
@okechukwuerinne2039 2 жыл бұрын
I tried this and got a wrong output. I got "4 is a prime number." Perhaps I messed up the program somewhere.
@lolbaba7403
@lolbaba7403 2 жыл бұрын
@@okechukwuerinne2039 number=2 divisor=2 if number ==divisor or number==1: print("prime number") else: if number%divisor==0: print("Not prine") else: print("Prime") This is code for short range. But when it comes to find prime number in some range then this code is wrong.
@shayaanrk
@shayaanrk Жыл бұрын
@@okechukwuerinne2039 for such basic exceptions, you should have already added another if statement. if num%2==0 then print False
@omkar1592
@omkar1592 3 жыл бұрын
your voice and explanation both are amazing
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you 😊
@galadimatimothy802
@galadimatimothy802 5 жыл бұрын
Well done.. Perfectly explained
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@shruthisagar7677
@shruthisagar7677 7 жыл бұрын
Hi . Very well explained . Easy to understand and solve it Thank You
@AmulsAcademy
@AmulsAcademy 7 жыл бұрын
Welcome:)
@radiagulzan
@radiagulzan 5 жыл бұрын
Thank you so much! But, what do we do with the input 2 in the end?
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
2 is a prime number :)
@darshanchaudhari9836
@darshanchaudhari9836 3 жыл бұрын
Bro same doubt , did you get the answer
@dudeinspace1491
@dudeinspace1491 3 жыл бұрын
Ur voice keeps entertaining..!
@Pikachu-dw3qk
@Pikachu-dw3qk 3 жыл бұрын
mam please say how this technique applies if we give input number 2 ??? for other numbers i understood this code perfectly except number 2 case please reply mam
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
When input is 2, for loop body will not execute and else part will execute :) In for loop start is 2 and end is 2 so it won’t execute loop body :) And because for loop is not terminated by break statement , else par will execute :)
@Pikachu-dw3qk
@Pikachu-dw3qk 3 жыл бұрын
@@AmulsAcademy ok mam i got it thanks for the reply
@darthsidious1137
@darthsidious1137 5 жыл бұрын
Wish I would of found this video a couple hours ago. Had to settle with the brute force method for my assignment.
@unclerojelio6320
@unclerojelio6320 4 жыл бұрын
There is not need to check the for divisors greater than sqrt(num). You can increase the efficiency of this program quite a bit by changing the for loop to: for i in range(2, sqrt(num))
@ganpatinatrajan5890
@ganpatinatrajan5890 2 жыл бұрын
Excellent Explanations...👍👍👍
@trundlingwithjoy2237
@trundlingwithjoy2237 3 жыл бұрын
thank you for this keep up the good work
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you 😊❤️
@rajangymtech.7073
@rajangymtech.7073 2 жыл бұрын
Your teching ideas mind blowing
@SanOp-zx1pc
@SanOp-zx1pc Жыл бұрын
this code is wrong input numbers like 27,321,etc... which are not divisible by 2 but are not prime numbers.... still the programme gives the numbers to be prime correct programme code num=int(input('Enter a positive number :')) if num > 1: # Iterate from 2 to n / 2 for i in range(2, int(num/2)+1): # If num is divisible by any number between # 2 and n / 2, it is not prime if (num % i) == 0: print(num, "is not a prime number") break else: print(num, "is a prime number") elif num==0: print(num,'is neither prime nor composite.....') else: print(num, "is not a prime number")
@SanOp-zx1pc
@SanOp-zx1pc Жыл бұрын
@@A4KSHAT Bro is 27 a prime number??? ofcourse not , so how it is showing that it is a prime number
@A4KSHAT
@A4KSHAT Жыл бұрын
@@SanOp-zx1pc i am sorry it is show it is not a prime number
@listentosilently
@listentosilently 3 жыл бұрын
Video is good #TECH_INTERVIEW_PREPRATION
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you 😊
@listentosilently
@listentosilently 3 жыл бұрын
🙏🙏🙏
@amansharma-it4df
@amansharma-it4df 2 жыл бұрын
Very good video you solve me very very big problem thank you very much again
@daniellejdevlin8882
@daniellejdevlin8882 3 жыл бұрын
Can you explain why number=2 shows up as prime in the code when 2÷2=0? I know 2 is prime
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Check for loop range 😊
@okechukwuerinne2039
@okechukwuerinne2039 2 жыл бұрын
Thank you so much for this; it was a life saver.
@obulasettyganesh8920
@obulasettyganesh8920 2 жыл бұрын
🤣🤣🤣🤣
@shivabagareddy9195
@shivabagareddy9195 4 жыл бұрын
Good explanation with impressive voice..... Want to listen more of your voice:)
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Thank you :)
@dharmikmistry8781
@dharmikmistry8781 4 жыл бұрын
It's very good 👏👏👍
@smartcat5989
@smartcat5989 Жыл бұрын
mam do you teach in valia ?
@lilyfullery4779
@lilyfullery4779 6 ай бұрын
Too good ❤
@ashishsinha5015
@ashishsinha5015 4 жыл бұрын
mam why you have used else with for loop but not with if
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
else case can be used with loops also :) here we need else part with for loop :)
@vidithnarayana2346
@vidithnarayana2346 5 жыл бұрын
I like your explanation 👌👌 TQ so much
@jnageswararao8574
@jnageswararao8574 3 жыл бұрын
U voice is good....
@varshacm1444
@varshacm1444 4 жыл бұрын
Mam why else is straight under for loop it should be under if know mam plse do reply mam
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
We can use else case with loops also. Here we want else part with for loop. The else block just after for/while is executed only when the loop is NOT terminated by a break statement.
@possiblesupport1029
@possiblesupport1029 2 жыл бұрын
Super explaination on the whole youtube
@nareshchoudhary4799
@nareshchoudhary4799 2 жыл бұрын
How to save it with which name
@pravaalc8409
@pravaalc8409 4 жыл бұрын
Nicely explained, but if i enter number as 2, the code does not execute. please help
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Thank you :) No it will work properly for input 2.
@pravaalc8409
@pravaalc8409 4 жыл бұрын
@@AmulsAcademy thank you. noticed indentation was not properly placed in my code
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Yes indentation matters a lot in python :)
@trundlingwithjoy2237
@trundlingwithjoy2237 3 жыл бұрын
maam but if we put 9 it is showing that it is a prime number but as we know that it is not a prime number.....maam how to solve this problem?/
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Give me the program 😊
@deepikamathur9466
@deepikamathur9466 3 жыл бұрын
Nice mam..
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you :)
@paviyug
@paviyug 4 жыл бұрын
you explained it very Well
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Thank you :)
@Engineer9060
@Engineer9060 2 жыл бұрын
no she explained wrong go for 21,9
@hetanshikothari4177
@hetanshikothari4177 4 жыл бұрын
Here i got stuck with case number =2 here 2 modulo 2 will be 0 still it prints 2 is a prime number how does that work
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
in the for loop we took range from 0 to num when num=2 range becomes 2 to 2 range(2,2) so it won't execute for loop body :) You can execute this and check for i in range(2,2): print("hello") else: print("hi")
@hetanshikothari4177
@hetanshikothari4177 4 жыл бұрын
Amulya's Academy thank you so much for the explanation!! Got it
@ameyashetty1441
@ameyashetty1441 3 жыл бұрын
hey 2 is a prime no but 2%2==0 then how does this work
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Please check for loop range, starting value and end value is same that is 2, so it won’t execute loop body 😊
@nandith1473
@nandith1473 Жыл бұрын
@@AmulsAcademy no it's not same it becomes(2,1) right as end value is excluded
@Raja-tt4ll
@Raja-tt4ll 5 жыл бұрын
Great explanation thanks
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@asrithavardhini956
@asrithavardhini956 4 жыл бұрын
by writing your code, for number 2 it is not showing anything..please help me
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
No it will print 2 is prime number. Give me the program i will check for you :)
@asrithavardhini956
@asrithavardhini956 4 жыл бұрын
Thanks:) it's working...👍😊
@bakrymohamed8711
@bakrymohamed8711 4 жыл бұрын
my teacher I think we don't need the break statement so that after the if condition becomes false the for else will work
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
The else block just after for/while is executed only when the loop is NOT terminated by a break statement. So you need to break statement here. Note: remove break and try to execute the program.
@bakrymohamed8711
@bakrymohamed8711 4 жыл бұрын
@@AmulsAcademy right
@dharshinimagesh9591
@dharshinimagesh9591 5 жыл бұрын
hi mam, pl write this example with while loop . i hav tried many times but always stuck wit where to give the increment "i=i+1" operator .
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
num = int(input(":")) if num > 1: i = 2 while i < num: if (num % i) == 0: print(num,"is not a prime number") break i =i+1 else: print(num,"is a prime number") else: print(num,"is not a prime number") :)
@dharshinimagesh9591
@dharshinimagesh9591 5 жыл бұрын
@@AmulsAcademy thank u very much . can u pl tel me wats wrong in this code n if possible could u correct it ?
@dharshinimagesh9591
@dharshinimagesh9591 5 жыл бұрын
lower=int(input("lower no ")) upper=int(input("upper no ")) i = 2 for num in range (upper,lower+1): while i < num: if (num % i) == 0: print(num,"is not a prime number") break i =i+1 else: print(num,"is a prime number") i want to print prime no's in the intervals like this, without two for loops ..
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
lower=int(input("lower no ")) upper=int(input("upper no ")) for num in range (lower,upper+1): i=2 while i < num: if (num % i) == 0: #print(num) print(num,"is not a prime number") break i =i+1 else: print(num,"is a prime number") Try this :)
@dharshinimagesh9591
@dharshinimagesh9591 5 жыл бұрын
​@@AmulsAcademy thank u very much mam . I've identified my mistake 🙏 u dont believe me , i have been fighting with this prime no's prg for past TEN days and I've found ur videos accidentally and i havnt expected this much response from u . u r really a respectful and a responsible teacher .🙏
@mika4444
@mika4444 3 жыл бұрын
how to check the number is a prime number in a range entered by the user????
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Give me an example :)
@mika4444
@mika4444 3 жыл бұрын
@@AmulsAcademy for example...user enters the starting range and ending range...from that range we have to find which numbers are prime numbers.
@tuomasbazzan1523
@tuomasbazzan1523 3 жыл бұрын
Thank you
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Pleasure :)
@Unidentifying
@Unidentifying 4 жыл бұрын
How to do this without using break ?
@shivprakashyadav3814
@shivprakashyadav3814 3 жыл бұрын
why else is used for for loop not for if
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
We can use else case with loops :)
@bhavithasulax.
@bhavithasulax. 3 жыл бұрын
Mam how can we print those prime numbers
@RK-jv3kw
@RK-jv3kw 4 жыл бұрын
Are u from tamil nadu ? i understood well thanks for the video
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
No I am from Karnataka. Thank you :)
@RK-jv3kw
@RK-jv3kw 4 жыл бұрын
@@AmulsAcademy i am from kerala, i can easly recognise south indains
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Hello :)
@RK-jv3kw
@RK-jv3kw 4 жыл бұрын
@@AmulsAcademy hello
@RK-jv3kw
@RK-jv3kw 4 жыл бұрын
you are nice teacher
@urvi23
@urvi23 2 жыл бұрын
Mam if we check no 2 how it will work?
@seaofplatitudes780
@seaofplatitudes780 2 жыл бұрын
I was wondering the same thing.
@gayathri-8-i6s
@gayathri-8-i6s 3 жыл бұрын
Sisy.. plz put videos for sum of next 2 consecutive numbers
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Will try 😊
@umairgillani699
@umairgillani699 6 жыл бұрын
how about if we want to check the list of prime numbers in a range x to y, where x and y could be any range..
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
I did make a video on how to print prime numbers in particular range please check that :)
@umairgillani699
@umairgillani699 6 жыл бұрын
@@AmulsAcademy Yes watched it. It makes a good logic. Please come up with more videos like these :)
@nishasrinivasan4621
@nishasrinivasan4621 4 жыл бұрын
Thank you so much for this
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
My Pleasure :)
@uk0707raptor
@uk0707raptor 2 жыл бұрын
Mam this code is not working for number 2.
@sandeepsinghnegi9220
@sandeepsinghnegi9220 6 жыл бұрын
please help i am getting 55 as prime number. by writing below code. num= int(input("enter any number")) for i in range(2, num): if (num % i) == 0: print (num,' number is not prime') break else: print (num,' number is prime') break
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
num= int(input("enter any number")) for i in range(2, num): if (num % i) == 0: print (num,' number is not prime') break else: print (num,' number is prime') Now check whether it will give correct output or not :)
@sandeepsinghnegi9220
@sandeepsinghnegi9220 6 жыл бұрын
num = int(input("enter number to check prime number : .. ")) for i in range(2,num): if (num % i ) == 0: print (num,"not prime") break else: print(num,"number is prime")
@aniketpatil1737
@aniketpatil1737 3 жыл бұрын
I am watching this masterpiece in Dec 2021
@kairu9373
@kairu9373 4 жыл бұрын
Even or Odd and Prime or Composite numbers are different programming logics. What you are trying to imply in here is that every number divisible by 2 is not a Prime number when 9, 15, 21 and so on are not Prime numbers and are not divisible by 2. This is unclear and confusing. The way the tutorial is being discussed has never changed and is still the same as other content creators stating they found the answer behind Prime number logics.
@Engineer9060
@Engineer9060 2 жыл бұрын
you are the only one in the comment whom i found have some knowledge, other than people here are saying they are clear , its just a soln for even no. not for prime no.
@KimTae47016
@KimTae47016 2 жыл бұрын
I was also confused that by using this method it will print prime statements even for odd numbers..
@Sandeep-sh7uc
@Sandeep-sh7uc 7 ай бұрын
You wrote print(num,"is not a prime number" ) in FOR loop why it is not printing for num number of times
@crewmate3031
@crewmate3031 4 жыл бұрын
Mam why did u use break. Can u tell me the use of it please 🙏🙏
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
if you want to exit from the loop then you can use break inside the loop. Execute the program without break you can see the difference :)
@crewmate3031
@crewmate3031 4 жыл бұрын
@@AmulsAcademy oo ok mam thanks
@SevenStepsAhead
@SevenStepsAhead 2 жыл бұрын
its remainder not reminder lmao
@ajithkumarm9446
@ajithkumarm9446 5 жыл бұрын
Mam, why are u using for loop for all program?
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
If you want you can use while loop also. :)
@prasanthkrishnam62
@prasanthkrishnam62 4 жыл бұрын
How to get a preceding number of a given number
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
input-1 :)
@vishaljat4398
@vishaljat4398 3 жыл бұрын
Thank you❤
@tanweerkarzai7355
@tanweerkarzai7355 3 жыл бұрын
withought using breal ,how to solve it
@byjusCOM-pw7xn
@byjusCOM-pw7xn 5 жыл бұрын
Ur range function is not working may I know the reason
@bibekanandasahoo3497
@bibekanandasahoo3497 3 жыл бұрын
How I write this code in list comprehension method
@jeetgupta2286
@jeetgupta2286 4 жыл бұрын
Thank u didi ❣️❣️🙏🙏
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Most welcome 😊
@totansarker5460
@totansarker5460 4 жыл бұрын
wow.. thank you very much.
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
You are most welcome :)
@aryavs4555
@aryavs4555 6 жыл бұрын
may i give u a suggestion pls run the programme and show us the output it will ensure that ur codes are correct
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Thank you for the suggestion:) Didn't i show the output in this video? Usually i do execute my program. :)
@zizo8737
@zizo8737 6 жыл бұрын
Arya V S Watch the video properly she has shown the execution
@yadavj12
@yadavj12 2 жыл бұрын
Hello dear we have to find out a prime number or not means there is three conditions can you please explain those three conditions
@pillarikala266
@pillarikala266 4 жыл бұрын
Plz tell with while loop
@muskaangupta4915
@muskaangupta4915 2 жыл бұрын
% k bd wala else iff k indention m aan chahiy th na jo for k nicje ku aara
@kryptonboron6104
@kryptonboron6104 4 жыл бұрын
Mam...it is not working for *21* . What to do? But thanks for the video mam
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
21 is not prime number right ? What is the problem ? :)
@kryptonboron6104
@kryptonboron6104 4 жыл бұрын
Mam....When I entered 21, then it checks and says that *21 is prime* . Then I again tried designing a new code for it. Thanks for your reply mam😄
@itzscytesalpha2963
@itzscytesalpha2963 3 жыл бұрын
Nice vid
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you :)
@TJ-wo1xt
@TJ-wo1xt 3 жыл бұрын
nice one.
@ananddarshan1114
@ananddarshan1114 3 жыл бұрын
then why the hell my program says 9 and 15 are prime number when i write the same program as yours.
@swatimaskawade5321
@swatimaskawade5321 3 жыл бұрын
can't we add int in the input statement ?🤔🤔🤔🤔🤔🤔
@maassterpiece
@maassterpiece 5 жыл бұрын
Madam I following your classes daily I am big fan of u yesterday I attended one interview I passed written test In second round they conducted system test But they gave to me a difficult task That task name is FLAMES I HOPE YOU KNOW THAT FLAMES CONCEPT before he conduct the system test He explained to me that FLAMES Take two persons name Cancel that common letters Count the remaining Letters For example total remaining letters are:(5) How to get this out put By using ptython code Plz explain this out madam
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Try this: str1 = input("name1:") str2 = input("name2:") for i in str1: for j in str2: if i==j: str1=str1.replace(i,"",1) str2=str2.replace(i,"",1) print(i,j) print(str1,str2) print("remaining characters in str1:",len(str1)) print("remaining characters in str2:",len(str2)) :)
@ramurachineni2255
@ramurachineni2255 3 жыл бұрын
How to do same program with while loop
@itzboyon6983
@itzboyon6983 4 жыл бұрын
but if i input 2 it comes out nothing, i know it is a prime number
@kratishrivastava6984
@kratishrivastava6984 7 жыл бұрын
plz tell me if num = 2
@AmulsAcademy
@AmulsAcademy 7 жыл бұрын
2 is a prime number:)
@babusingh7837
@babusingh7837 6 жыл бұрын
there is some mistake in your code see carefully
@vasudevareddy6749
@vasudevareddy6749 5 жыл бұрын
@kumari sonali ,code is working fine,give lower bound as 2,then it will print including with 2
@rashikrishna1538
@rashikrishna1538 2 ай бұрын
1. Ask the user to input a number. 2. If the number is
@anshumanchoudhary2658
@anshumanchoudhary2658 2 жыл бұрын
a=int(input("enter:")) if (a%2==0) or (a%3==0): print("it is not prime number") else: print("it is prime") this is write or wrong
@anusmitasamanta2608
@anusmitasamanta2608 5 жыл бұрын
amazing ...
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@vickykolle8821
@vickykolle8821 6 жыл бұрын
Wt happend if we not type a break
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
you won't get proper output:) When we get divisor of given number then we know that number is not prime so we need to come out of the loop that's why we used break :)
@nabeelmalik.4714
@nabeelmalik.4714 5 жыл бұрын
If we use negative value then error occur...
@rahuljuneja1185
@rahuljuneja1185 6 жыл бұрын
According to your code,it starts dividing by 2. So,2%2==0 Then according to your code,2 should not be a prime number
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
No because in the for loop range will become 2 to 2 at that time . so it won't execute for loop directly goes to else part :)
@rahuljuneja1185
@rahuljuneja1185 6 жыл бұрын
Amuls Academy Thanks.
@rohitjoshi1777
@rohitjoshi1777 5 жыл бұрын
@@AmulsAcademy Did not understood range become 2 to 2 at that time
@gowthamselvaraj7793
@gowthamselvaraj7793 Жыл бұрын
Please explain Circular prime number in python mam
@manuaugustine750
@manuaugustine750 5 жыл бұрын
try 15 and see what output you will get
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
15 is not prime number :)
@ryder3099
@ryder3099 3 жыл бұрын
One correction it is remainder not reminder
@ahinav.s1925
@ahinav.s1925 2 жыл бұрын
Thanks
@Engineer9060
@Engineer9060 2 жыл бұрын
wrong concept .plz correct it acc to uyou when i will take 21 as ainput it will show it is prime no. as 21%2==1 but 21 is not a prime nno. ur soln is for even no.
@r4d1calwr4th7
@r4d1calwr4th7 5 жыл бұрын
try 15 it is showing a prime no.
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
No it won't print 15 as prime number :)
@gandrakavya8201
@gandrakavya8201 3 жыл бұрын
thank you mam!!!....ur vedios make me to solve programs on my own :)
@addictedroaster1573
@addictedroaster1573 3 жыл бұрын
Instead of this large code.. We can do.. Num modulus 2 Or 3....remainder not eaual to 0 then it's PRIME NUMBER
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
That’s what we are doing here 😊
@addictedroaster1573
@addictedroaster1573 3 жыл бұрын
@@AmulsAcademy please make video on python interview programming question.. But not mcq... Something like paragraph narrated question.... Need it because I am final year student.. Please
@Engineer9060
@Engineer9060 2 жыл бұрын
@@AmulsAcademy sry but i thinks its a wrong code bcz for 21,9 it will show prime.
@swathinagarajan4804
@swathinagarajan4804 3 жыл бұрын
Tq mam
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Pleasure 😊
@Aaron_duckroast
@Aaron_duckroast 3 жыл бұрын
TYSM!!
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Pleasure :)
@bloodbath8804
@bloodbath8804 4 жыл бұрын
while True: print(" thankyou very much")
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Welcome :)
@nagarani.g1694
@nagarani.g1694 4 жыл бұрын
plese insert by with alagorithm
@vodka_and_chopsticks8586
@vodka_and_chopsticks8586 4 жыл бұрын
not gonna work with big numbers like 150, the python will crash, because there will be too many loops
@shivameher3787
@shivameher3787 4 жыл бұрын
if num=2 then the remainder will become zero so how it is a prime anyone??
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
when num=2 it won't execute the for loop body. range(2,num) so it will become range(2,2) it won't give any value. :)
@itsmeaman143
@itsmeaman143 4 жыл бұрын
So what shall we do ao that it get printed 2 is a prime number?
@arrceusx
@arrceusx 4 жыл бұрын
@@itsmeaman143 set the range from (2, num//2) it"ll return 2 as prime
@komaljaswani7497
@komaljaswani7497 5 жыл бұрын
Hi! Can you please make a video on the question: If a list in python has mix of strings & numbers, how will you make separate lists of strings & numbers? I saw ord() for getting ASCII code in python & chr() for converting ASCII codes to characters somewhere & tried to use them to get answer of this question but it did not work!! :(
@shayaanrk
@shayaanrk Жыл бұрын
strings are sortd out by str(input) while numbers are sorted out by int(input)
Python Tutorial - Program to Print Perfect Numbers in Given Interval
12:27
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Python Tutorial - Prime Numbers | Printing Prime Numbers in Given Interval
18:33
Leap Year Program | Python Tutorials
12:12
Amulya's Academy
Рет қаралды 78 М.
Solve any Series Program in Python
20:15
Simply Coding
Рет қаралды 47 М.
Python Program #17 - Check Armstrong Number in Python
8:44
Programming For Beginners
Рет қаралды 16 М.
PRIME NUMBER PROGRAM IN PYTHON PROGRAMMING || PYTHON PROGRAMMING
7:45
Sundeep Saradhi Kanthety
Рет қаралды 84 М.
Program To Calculate LCM Of Two Numbers | Python Tutorials
19:20
Amulya's Academy
Рет қаралды 65 М.
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.