😎Hey, thanks for watching! We’d love to know your thoughts/doubts here in the comments. 👉For professional self-paced certification courses (pre-recorded), visit: bit.ly/Pre-Recorded-Course 👉Don’t forget to SUBSCRIBE to our channel for more such videos & valuable content: bit.ly/KZbin-WsCubeTech
@ihaveitinme638 Жыл бұрын
def prime_number(n): if n==1: b=print(n,":not prime") return b if n>1: for i in range(2,n): if n%i==0: c=print(n,":not prime") return c break else: print(n,":prime number") n=int(input("enter number:")) prime_number(n)
@BMWCLASSICS_5 ай бұрын
bro i think in last we also have to put break when i run it on my pc it shows 2 output
@AbCd-n3j3 ай бұрын
Bero 2 is also a prime no. Thia code ia not working for 2
@Hindustani-dl8lpАй бұрын
Wow bro
@sakshimourya5418 Жыл бұрын
you deserve more likes, cleared my concept completely.
@GoGetSP5 ай бұрын
num=int(input("Enter a num to check whether prime or not:")) if num == 1: print(num,"is not a prime number.") elif num == 2: print(num,"is the smallest prime number.") else: for i in range(2,num): if num % i ==0: print(num," is not a prime number.") else: print(num,"is a prime number.") break
@VARADHARLIKAR-ul1oc6 ай бұрын
def prime_number(n): if n==1: b=print(n,"is not an prime number") return b if n>1: for i in range(2,n): if n%i==0: c=print(n,"is not an prime number") return c break else: print(n,"is prime number") n=int(input("enter the number to check :")) prime_number(n)
@Raj-v8j5u Жыл бұрын
Thanks mam. Even telusko hadnt explained this topic this superb. It helped me who is from no CS background.
@sushantchougale68182 жыл бұрын
Thank you very much 😊 ☺️
@gauravpandey973910 ай бұрын
You are amazing mam❤
@itsonlytech82512 жыл бұрын
Nice Information
@Anubhav_Sh_11 ай бұрын
very helpful playlist.
@comingsoon..425810 ай бұрын
computer science students attendance here
@Bunty7597 ай бұрын
Present sir
@PavitraShukla20513 күн бұрын
Your loop checks divisors up to num - 1. While this works, it is not efficient for larger numbers. You only need to check divisors up to the square root of the number (int(num**0.5) + 1). This is because if a number n has a factor larger than its square root, it must also have a smaller factor below the square root.
@niraj_cn2 жыл бұрын
Nice video
@00__mdasif2 жыл бұрын
We wanna deep sir python videos please upload plz....
@Naresh-Bhaydiya-Programmer2 жыл бұрын
Grateful
@tabariqawabullah0626 Жыл бұрын
Great video. But This code is saying 9,15,21... are prime numbers but they are not. Any idea why?
@madiripadma3877 Жыл бұрын
Prime number means the number divisible by 1 and itself.for eg : 5 5 is divisible by 1 and 5 only so it is prime number.
@AdityaThakur-cq1ov Жыл бұрын
I think something wrong with this code.... it's say 49 is prime .....kese......
@karthikchinna3621 Жыл бұрын
You need to add break statment
@anud1917 Жыл бұрын
# 11:program to check if any given number is a prime number. num = int(input("enter the number")) if num
@sapisgreat11 ай бұрын
doesnt work with 0
@asishkumarpatro59039 ай бұрын
@@sapisgreatwill work bhai
@sapisgreat9 ай бұрын
@@asishkumarpatro5903 didnt for me
@I.agri.4 ай бұрын
@@sapisgreat that's because 0 is neither a prime nor a composite.
@asifcreative64362 ай бұрын
Not working for 2
@oxivrushab2573 Жыл бұрын
num=float(input(" enter the number ")) if(num%2==0)or(num%3==0)or(num%4==0)or(num%5==0)or(num%6==0)or(num%7==0)or(num%8==0)or(num%9==0)or(num%11==0): print( " number is not prime") else: print(" the numver is prime")
@Mr.Regaltos Жыл бұрын
it will say 13 is not prime wrong
@asishkumarpatro59039 ай бұрын
Bhai infinite prime h tu aise nahi kar sakta
@kabeersharma6403 Жыл бұрын
Thanku Thanku Thanku Thanku
@ronak-myself2 жыл бұрын
Sb samajh agya
@gtdforum Жыл бұрын
Is there a need for a for loop in this example
@adityatorane1234Ай бұрын
num=int(input("enter num:-")) if(num%2): print("it is prime number") else: print("it is not a prime number") this code is also working to check prime number
@Arun_Pundhir00727 күн бұрын
Does it work for 2??
@sohebsk2196 Жыл бұрын
this code does not hold for some numbers,,,here isthe correct version: n=int(input("ENTER A NUMBER=")) if n
@asishkumarpatro59039 ай бұрын
2 is prime brother
@Zapoodle8Ай бұрын
@@asishkumarpatro5903 yes...
@khushiv2003 Жыл бұрын
n=int(input()) if n==1: print('n is not prime') elif n==2: print('n is prime') else: for i in range(2,n): if n%i==0: print('n is not prime') break else: print('n is prime')
@rushijadhav69036 ай бұрын
What about 99,15,21,25 they are not prime number
@Vivekyaadavvlogs2 ай бұрын
❤
@prittamsingh4453 Жыл бұрын
mam which software you are using
@prinjaymandani7419 Жыл бұрын
pycharm
@AbCd-n3j3 ай бұрын
2 is also a prime number and this code wont workjng on 2
@abhijeetsinghyadav89889 ай бұрын
n= int(input("Enter any number: ")) if (n%n==0) and (n%2!=0) and (n>1): print("Given number is a prime ") else: print("No is not a prime ")
@akashrai52538 ай бұрын
This same condition is apply to many numbers like 15 when it is divided by 2 it will not return 0 but it is not a prime number, so this condition will not work even mam's condition is also not working.
@statusvideo2701 Жыл бұрын
Which platform(application) maam is using to run python code ... Please someone reply...
@shubham_gaming-i2v Жыл бұрын
pi charm
@manjari400 Жыл бұрын
This code is not working appropriately for 2 and the odd numbers that are non prime number like 15,21,9 etc.
@AshishVerma13yq11 ай бұрын
Same doubt
@Staredits00610 ай бұрын
Same
@badalmishra73959 ай бұрын
It is working fine. I think the problem you got is with "else" . You need to shift it as she said backwards
@asishkumarpatro59039 ай бұрын
@@badalmishra7395but shouldn't if and else statements be in the same indentation?
@badalmishra73959 ай бұрын
@@asishkumarpatro5903 yes correct. But in this case if you use the same indentation as "if" in the for loop, it will throw "it is a prime number " multiple time , to break that loop for the output printed once, we need to get that else out of that for loop indentation or use the same indentation used for "for loop" statement. Secondly else should be the same indentation as "if" -True , but , here we have 3 ifs', and the code determines what should be the indentation of else. That's how loop function works
@bgmiviralshort2 жыл бұрын
Good
@itzmasum10792 жыл бұрын
With this code please try input "2"
@Aditya_Deshmukh Жыл бұрын
x =int(input("Enter Your Number Please: ")) if x == 2: print("A Prime Number.") else: for i in range(2,x): if x % i == 0: print("Not a Prime Number.") break else: print("A Prime Number.")
@raosajid65782 жыл бұрын
9 is does not satisfy your code if user enter 9 then it will give us it is prime but it is not
@rohitraj7914 Жыл бұрын
9 jb enter krenge to num=9 ho jayega to loop 2-8 tk hi chlega. So condition is satisfying for 9 also.
@asishkumarpatro59039 ай бұрын
@@rohitraj7914no brother 9 divisible by 3 so it doesn't work
@oxivrushab2573 Жыл бұрын
Can we use only in if condition using or like number which divides by 2,3,4,5,7,6,8,9,11 are not prime else are prime my work effectively
@impavel3235 ай бұрын
a= ("Thank You Mam") Print(a)
@cnadegameplay80317 ай бұрын
hey, check 43 as input.
@gamingstudyff95252 жыл бұрын
Hello sir I am a school student . Sir mai athichal hacking sikhna chahta hu plz mere ko batai ki Whete to star
@AdityaThakur-cq1ov Жыл бұрын
Abhi se phle where ki spelling thik kro fir agge dekhte h
@sahildash7222 Жыл бұрын
num=13 fcount=0 for f in range(1,num+1): if(num%f==0): fcount=fcount=1 if(fcount==0): print('It is a prime number') else: print('not a prime number')
@rameezraja2489 Жыл бұрын
Simple program ko itna complex kyu bana Diya aapne ek hi condition lagega if num%==0 then print non prime number then else num%==1 then print....... whatever you want to print
@tcimert Жыл бұрын
Another metho num = int(input("Enter a number ")) count = 0 if num>1: for i in range(1,num+1): if (num%i) == 0: count =count+1 if count == 2: print(num,"is a prime number") else: print(num,"is not a prime number")
@asishkumarpatro59039 ай бұрын
Won't work 1 se sabka remainder 0 aayega
@wannabe_gamer12307 ай бұрын
How about 2?
@rishiraj2548 Жыл бұрын
print("Prime Number Check") num = int(input("Enter a number to check: ")) status = "prime" if num
@Aditya_Deshmukh Жыл бұрын
x =int(input("Enter Your Number Please: ")) if x == 2: print("A Prime Number.") else: for i in range(2,x): if x % i == 0: print("Not a Prime Number.") break else: print("A Prime Number.")
@m.abdullahm.abdullah50002 ай бұрын
i understand prime is difficult in python
@bobbyrajgorai695 Жыл бұрын
we can use this also; x=float(input('enter the year')) if (x+1)/2%2==0 : print ( ' the no. is prime') else: print (' the no. is not prime')
@oxivrushab2573 Жыл бұрын
Not effective bro👍🏻
@oxivrushab2573 Жыл бұрын
For 27
@ShubhamSharma-od6tf3 ай бұрын
Wrong code ❌ , as number is only being checked by dividing it by 2 .
@tcimert Жыл бұрын
num = int(input("Enter a number ")) if num < 2: print("Enter a number") elif num == 2: print(" 2 is a prime number") else: for i in range(2,num): if num%i ==0: print(num,"is not a prime number") break else: print(num,"is a prime number")
@shubham_gaming-i2v Жыл бұрын
@turyachaitanya if num < 2: print("Enter a number") elif num == 2: print(" 2 is a prime number") ye vala part ka use kya tha jab 2 se num tak spicify kar rahe hai tu
@tcimert Жыл бұрын
@@shubham_gaming-i2v 2%2 is 0, it will say not prime, but 2 is prime. So a line is written for 2.
@dhaHu Жыл бұрын
People starting in English and later changing their language 🙂but y
@saritashukla1239 ай бұрын
This code is not right.
@VineelDikkala6 ай бұрын
Why bro??
@GigaChad999max6 ай бұрын
@@VineelDikkala because 93 is not a prime number but this code shows it is a prime number
@premgautam49572 жыл бұрын
Please help me sir
@sunnyyadav12984 ай бұрын
Didi nhi ho paya tumse rehne do
@DataEngineer586 Жыл бұрын
n= int(input("Enter any number: ")) if (n%n==0 and n%2!=0 and n>1): print("Given number is a prime ") else: print("No is not a prime ") # please let me know if this method is wrong of writing code
@ManishKumar-rd2iy Жыл бұрын
Your code is wrong bro
@swamantakmajumder48768 ай бұрын
a=int(input()) c=0 for i in range(1,a+1): if a%i==0: c=c+1 if(c==2): print("Prime number") else: print("Not prime")
@Lotus_TheGirlish6 ай бұрын
I did this...but this is nt working 😭annnnnn
@sumaiya_7305 ай бұрын
@@Lotus_TheGirlish it is working bro lol
@Lotus_TheGirlish4 ай бұрын
@@sumaiya_730 ok
@hrishabhbramhe16977 ай бұрын
x = 4 if x ==1: print('not a prime') elif x ==2: print('prime') elif x>2: for i in range(2,x): if x%i == 0: print('not prime') break else: print('prime') break
@ShubhamSharma-od6tf3 ай бұрын
It's wrong, try 17
@shubham_gaming-i2v Жыл бұрын
num=int (input("enter the number")) if num==1: print("not prime") for a in range(2,num): if num%a==0: print("it not a prime number") break else: print("prime number")