Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Comments
Bookmark
Share
Add to Playlist
Report
Lecture 50: Python with Boolean values
Nafees AI Lab
Follow
5/18/2025
To assign a boolean value in Python, use the keywords True or False. These are the only two boolean values in Python and are case-sensitive. You can assign them directly to a variable or as the result of a boolean expression.
Category
π
Learning
Transcript
Display full video transcript
00:00
In the first lecture, we had to play with Billy and Billy.
00:03
We had to play with the end condition,
00:06
so that Billy and the dog should be together,
00:11
so that the dog should be.
00:12
Right?
00:13
Good.
00:15
Now, we have to note that
00:18
I use the values of direct boolean values.
00:22
What if I write,
00:25
and here I write,
00:30
what do you think?
00:35
Basically, I do not like this,
00:39
that cat,
00:42
and dog,
00:44
because this variable is the value of the value.
00:48
So what do you think?
00:51
This is the value of the value.
00:56
If you give it to the condition,
00:58
it will be a boolean.
01:03
So if you give it to true value,
01:06
it will be a false return.
01:08
If I execute it,
01:10
what do you think?
01:11
Let's see.
01:13
Run.
01:14
And mouse run away.
01:16
Interesting enough.
01:18
This value has been true return,
01:20
and this value has been true return.
01:22
How is it possible?
01:24
How is it possible?
01:25
How is it possible?
01:26
That meow true is.
01:27
Boolean.
01:28
And wolf true is.
01:30
How is it possible?
01:31
One rule of thumb is,
01:34
that you call a simple bool function,
01:37
and then check the value for what it returns.
01:40
Let's say,
01:41
I give the bool to this,
01:42
and the bool to this,
01:43
and the bool to this,
01:44
and the wolf to this.
01:45
See we will see,
01:46
what bool is.
01:47
Why?
01:48
Because condition is,
01:50
at the end,
01:52
bool function of the bool form,
01:53
the value is called at the end.
01:55
The value is called.
01:57
The value is above.
01:58
The bool function of the bool function,
02:00
the bool function of the bool function.
02:02
The return as well.
02:03
Before the bool function of the bool function,
02:06
the bool function is called at the end.
02:09
So that doesn't belong.
02:10
Now,
02:11
I will see.
02:12
I mean, I will execute that both are true.
02:14
Isn't it interesting?
02:16
Very interesting.
02:18
If meow and woof true are,
02:21
then all which things are true?
02:23
Interesting, right?
02:25
If meow and woof are boolean in true return,
02:28
then it could be true exactly.
02:31
Then, false, which will be true?
02:33
Very good question.
02:35
False, which is very limited.
02:37
True, which is unlimited.
02:39
Basically, I am going to add a list.
02:41
These values, none, false, zero,
02:45
zero point zero, zero j, decimal of zero,
02:48
fraction zero one,
02:50
empty list, dictionary, empty tuple,
02:52
empty string.
02:54
Okay?
02:55
Empty byte, empty set.
02:58
These values are false.
03:00
I am not sure.
03:02
Let's do it.
03:04
Empty string is false.
03:06
I am not sure.
03:08
meow and woof,
03:30
I will do this.
03:31
I will do this.
03:32
Cat replace.
03:33
Okay.
03:34
And here we go.
03:35
Cat.
03:36
Cat.
03:37
Cat.
03:38
Now we execute.
03:39
And Kaboom Shaka Allah.
03:42
Mouse.
03:43
Why?
03:44
Empty string.
03:45
False return.
03:46
Isn't it cool?
03:47
It's very cool.
03:49
If you give empty list.
03:53
And in the other place, you give empty dictionary.
03:58
Right?
03:59
It's exactly your suit.
04:01
You are saying the same thing.
04:03
Mouse eat the cheese.
04:05
Right?
04:06
So basically, this is how I know.
04:09
If you think about it.
04:10
I know about Google.
04:13
Isn't it interesting?
04:15
Very interesting.
04:16
You don't have to memorize anything.
04:20
Don't memorize anything.
04:22
If you are programming.
04:24
Please stop right now.
04:27
Right now.
04:28
Right now.
04:29
Stop.
04:30
Don't memorize anything.
04:31
Everything is available.
04:32
Stack Overflow.
04:33
Stack Overflow.
04:34
Stack Overflow.
04:35
Stack Overflow.
04:36
Stack Overflow.
04:37
Stack Overflow.
04:38
Stack Overflow.
04:39
By the way, when you are looking at it, Stack Overflow.
04:41
Stack Overflow.
04:42
Stack Overflow.
04:43
Stack Overflow.
04:44
Stack Overflow.
04:45
Stack Overflow.
04:46
That is a result.
04:47
90% of the time.
04:48
Right?
04:49
Okay.
04:50
Stack Overflow.
04:51
So it's caught.
04:53
Cockγit open.
04:54
frog boom
Recommended
2:54
|
Up next
Lecture 34: Python has Boolean Data Type
Nafees AI Lab
5/16/2025
7:48
Lecture 51: Logical Operators in Python
Nafees AI Lab
5/19/2025
5:49
Lecture 60: Python has some functions
Nafees AI Lab
5/20/2025
6:07
Lecture 49: AND OR conditions in Python Programming
Nafees AI Lab
5/18/2025
1:53
Lecture 47: Coding Conditions in Python
Nafees AI Lab
5/18/2025
4:53
Lecture 52: An Identity Operators in Python
Nafees AI Lab
5/19/2025
6:23
Lecture 58: Python has keywords as Continue Break Pass
Nafees AI Lab
5/20/2025
11:19
Lecture 53: Python has for loop and Iterables
Nafees AI Lab
5/20/2025
3:23
Lecture 25: Statement vs Expression in Python
Nafees AI Lab
5/14/2025
8:48
Lecture 42: Dictionary in Python Language
Nafees AI Lab
5/18/2025
11:01
Lecture 48: if else condition in Python
Nafees AI Lab
5/18/2025
7:51
Lecture 44: Most Used Dictionary Methods in Python
Nafees AI Lab
5/18/2025
9:38
Episode 1 β The Curious Boy from Ulm (1879-1895)
Nafees AI Lab
6/8/2025
0:37
Top Fully Funded Scholarships in Germany 2025 π©πͺ | Apply Now!
Nafees AI Lab
6/3/2025
0:25
The Boy and the Dragon β βA Friend in the Skyβ
Nafees AI Lab
6/3/2025
1:03
Why Do Rainbows Appear? π | Physics in Everyday Life
Nafees AI Lab
6/3/2025
0:28
Albert Einstein: The Genius Who Changed Time
Nafees AI Lab
6/1/2025
0:40
Stephen Hawkingβs Life in 60 Seconds: From Wheelchair to the Universe
Nafees AI Lab
6/1/2025
0:36
The Forgotten Night Hitler Was Nearly Killed
Nafees AI Lab
5/29/2025
0:31
Dilip Kumar β The Tragedy King of Bollywood
Nafees AI Lab
5/29/2025
0:45
Marlon Brando β The Rebel Who Redefined Acting | Nafees AI Lab
Nafees AI Lab
5/29/2025
0:29
Charles Darwin β Evolution & Natural Selection | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:30
Isaac Newton β Gravity, Motion & Genius | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:52
Allama Iqbal β Poet of the East | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:53
Marie Curie β Life & Achievements | Nafees AI Lab
Nafees AI Lab
5/28/2025