Skip to playerSkip to main contentSkip to footer
  • 5/18/2025
In Python, and and or are logical operators used to combine or modify conditional statements.
and operator: Returns True if both conditions are True, otherwise, it returns False.
or operator: Returns True if at least one of the conditions is True, and False only if both conditions are False.
Transcript
00:00In this lecture, we have thoroughly discussed if, alif and else.
00:03In this lecture, we have two other keywords introduced to us.
00:08The first keyword is and, and then the second keyword is and.
00:15This is our keyword.
00:16We have to keep our keywords in our own mind.
00:18Now I will tell you what to say about this.
00:22Imagine that this is our previous story, Tom and Jerry.
00:26Okay, now imagine that this story in a while is the owner of the dog.
00:36Imagine that the dog is true.
00:37At the moment.
00:39Now, the question is that cat and dog are both together.
00:45Okay, now I will tell you that cat and dog, when someone exists,
00:54if you want to do it, then you want to do it.
00:57It's like that.
00:59Now, can I have two conditions in one condition?
01:03One condition in one condition?
01:05This is the answer.
01:07Yes, yes.
01:08And the two things combine to do it.
01:11It's either I can combine it or I can combine it,
01:15or I can combine it.
01:17Okay.
01:18Okay.
01:19First of all, I will show you the barebone structure.
01:22I will print the statement.
01:25I will say print true.
01:28Right?
01:29Now, we will execute it.
01:31I will remove it.
01:33Okay?
01:34Why, I will show you the deep barebone structure.
01:37Print true is true.
01:39is true, right, print false is false, no problem, yeh toh bhot hi asan hai na, halwa hai, yeh
01:47toh hume pata hai ki print false karo hoon toh false hi hai ga na, or yeh false keyword
01:51false hai, accha, however, agar mein kehta hoon, ek condition, let's say, ek value hai
02:00true, lekan usko combine karne laga hoon a keyword ke saath, and, aur phir, mein keha
02:06raha hoon true, right, ab agar mein isko print karta hoon, toh yeh keha raha true, ab basically
02:14ho kya raha hai, yehaan peh doh conditions aah gai hai, true and true, aur and ki khasiyat
02:20yeh hai, ke and wo, wo nye hota jaisa ke wo, apne dekha hooga, kanun ananda hota ho, hat mein
02:26doh pakde hootay hain, wo, wo jo hootay hain, yaar, wo, tolne wale, something like this,
02:33yeh is tarah ki chiz, apne dekhi hooghi, aise iske saath hootay hai, dousera iske saath
02:37aise hootay hai, and you see like, something like this, sahi hai, aise chiz, ab jo and
02:44key word hai na, wo iski tarah hai, aur and kehatta hai, ke mein usi wakt te dounou level ko
02:51balance ruk karun ga, jab dounou meire paas true hoonge, meire left or right pe, true and true,
02:57tbhi mein execute karun ga code ko, and ke saath left or right pe, jab true hoongi
03:07dounou statement, tbhi yeh true return karega, otherwise yeh false return karega, agar
03:12isme se ek bhi false hojati hai na yeh, to douseri ki kooi masala nahi hai, woh kaya ga
03:17ho, yeh false hai, I don't accept it, chalye yeh, mein aapko yeh karke dikhaatau, it's very important,
03:22important, uski reason yeh, ke jab hum, yeh, dhekheye, mein isko kata, isko run kerte
03:26hain, ab dhekheye, false hojaya, kyun, kyunke end ke liye, dounou statement, uske left
03:31or right pe, true hoonga, however, joh or hai, aur keyword, woh bhot lenient hai,
03:38isso walhe se, woh kata, yaar, meire liye, agar true return karna hai na, to koji
03:42ek bhi true hojai, meire left ya right pe, mao isko true kar dunga, ab dhekhe, mein isko run
03:45kerta hoong, usne true kar diya, make sense, acha, to waapas aate hai, humare,
03:51puranen example ke oopar, aur jis ke inder, humne dog ki example, mein nai
03:57aapko dikhaay thi, yeh, agar gih, dog do, ab mai kehta hoong ki, yaar, yeh, joh
04:03maoos hai na, usko dog jana chahiye, dog mai se koji bhi exist kerta ho, ab
04:09mujhe betaiye, ki, yaah peh, mein dog bhi liege deta hoong, ab kyunke, mein chahata hoong
04:13ke, yeh statement execute honi chahiye, chahe, in mein se koji ek true ho, chahe,
04:22ek, to yeh or ka case hai na, or true return karta tha, chahe, in mein se ek true ho, to
04:27agar, mein kaya deta hoong, aur, to basically, mein yeh likhaa hoong, is case mein toh
04:30dono true hai na, dono true hai, to true hai, however, is case mein agar
04:33mein false kar dieta hoong, dog ko, to basically, mein kya kar raha hoong, basically,
04:36mein yeh kar raha hoong, true or false, yeh kar raha hoong, to aur kya karta hoong,
04:43wo kata hai, yeh, chahe, dhono, meire left, right, peh, ek bhi, agar true hoong gai,
04:46to, mein true return karunga, to basically, wo kya karayega, yeh, peh, true return
04:50kar dhega, f dhekhega, if dhekhega, ke, meire saamne toh true hai, agar meire saamne
04:55true hai, wo kyega, mein isko execute karta hoong, no matter what, to, ap dhekhiye,
04:58mein doobara karta hoong, right, eek true, eek false hai, execute kiya, mouse run away,
05:04thik hai, kyun, kyun, kyunke, ya, kutte mein se, ya, billi mein se, koi bhi eek hooga,
05:09to, mouse run away ho jayega, thik hai, however, agar mein yahan peh end
05:14kehta hoong, to, dhono ko, ikathe, mوجود hoona, chahehe, tab, chuha,
05:19dhoΔ‘e ga, otherwise, chuha, nahi dhoΔ‘e ga, thik hai, ab dhekhiye,
05:23mein honor bhi false kar raha ho, kye, honor bhi nahi hai, thik hai, false,
05:28mein square run kerta hoong, mouse ne chiz kha lii hai, kyun, kyunke end
05:33kehta hoong, kyunke end kehta hoong, kyunke, man us wakt true return
05:35kerung ga, jab, kutta, aur billi, dhono, mوجود hoongge, dhono, true hoongge,
05:39to, iso liye, mein iso tarah kata hoong, yaar, kutta, tu bhi idheri aja, ab, cat bhi true,
05:42dog bhi true, ab true return hooga, ab mein iso karan karta hoong, true return hooga, ab
05:48mein iso karan karta hoong, now mouse run away, easy na, very easy,
05:53to, ab ne dekha, kye, hum ne, ek condition ko, hum jod bhi sakti hain, using,
05:59aur aur end keyword, thik hai,
06:02with this, let's close this video, see you in the next one,
06:05see you in the next one,

Recommended