Skip to playerSkip to main contentSkip to footer
  • 5/16/2025
The boolean data type in Python represents truth values, and can only have one of two possible values: True or False. These values are keywords in Python and must be capitalized correctly. Booleans are often the result of logical operations or comparisons.

Category

📚
Learning
Transcript
00:00Welcome back.
00:02So, now we have studied data types in string.
00:07And we have seen how it is ordered sequence.
00:10So, let's talk about boolean.
00:12In boolean, there are only two types exist.
00:15Either true or false.
00:17And if we go back to you,
00:20we will see an example.
00:22If you look true,
00:25this is blue turn.
00:27Python is recognized.
00:31Built-in key words.
00:33True and false.
00:34Imagine,
00:35this usage is used in program flow control,
00:42when you have to decide.
00:44Imagine, you have to come to camera,
00:46and you have to use light.
00:48But first of all,
00:49you want to check the light.
00:50So, I will define a variable.
00:52Has light.
00:53And is equal to true.
00:56Okay.
00:57Now, if you print it,
00:59if you print it,
01:00if you print it,
01:01it will show false.
01:02Of course, it will print true.
01:04Right?
01:05Because,
01:06has light true.
01:07If you print it,
01:09if you print it,
01:10then,
01:11has light false.
01:12And when you print it,
01:14it will show false.
01:15Interesting.
01:16Right?
01:17However,
01:18this means,
01:19is a change of condition,
01:21which means I may say,
01:22is a change of condition.
01:23For example,
01:24has light false.
01:25So,
01:26this means to turn on the switch.
01:28It means that
01:29we can create decision.
01:30So,
01:31decision you can create.
01:32We have to see the boolean and condition,
01:34which means you receive.
01:35Another keyword is true and false.
01:37true and false
01:37to be
01:38and true I'll do
01:38that it's bull
01:39bull
01:40bull
01:41bull
01:42Blue
01:43which is
01:43that bull
01:430
01:440
01:45false
01:45treat
01:46and 0
01:470
01:59physical
02:00and
02:000
02:01true
02:01treat
02:01and
02:02by the way
02:02normal
02:03convention
02:03I'll see
02:041
02:042
02:051
02:052
02:06کوئی number ہے نا zero کے علاوہ ہے
02:07تو اس کو یہ true treat کرے گا
02:09by the way یہ minus بھی ہو سکتا ہے
02:10but it's still not zero
02:12تو zero کے علاوہ کوئی بھی number true treat
02:14کیا جاتا ہے
02:15اسی طرح جب آپ کو string اس کو دیتے ہیں
02:18let's say this is string
02:20اور اس کو run کرتے ہیں
02:21تو bool کا جو value ہے
02:24وہ اس کو as a true consider کرتی ہے
02:25کیونکہ this is a string
02:27کوئی value ہے
02:28جب آپ اس کو کوئی value نہیں دیتے
02:30تو پھر یہ اس کو false treat کرتے ہیں
02:32میں اس کو دوبارہ run کرتا ہوں
02:34and you see it's false
02:36اب یہ دو چیزیں true اور false
02:39ہمارے بہت کام آنے والی ہیں
02:41جب ہم conditional flow control
02:43یا program flow control کی بات کریں گے
02:45congratulations
02:46یہ سب سے چھوٹی data type تھی
02:48اور سب سے آسان تھی
02:49ایسا ہی ہے نا
02:50I hope you guys have enjoyed it a lot

Recommended