From the course: Python for Non-Programmers
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Booleans and if statements - Python Tutorial
From the course: Python for Non-Programmers
Booleans and if statements
- [Instructor] We know about three types right now. We know about integers, floats, and strings. We're now going to learn a fourth type, which is called a Boolean. A Boolean is a way to represent a yes or no situation, true or false, one or zero. If you've ever heard the term binary, that's exactly what a Boolean is. It's either this thing or that. So you may be thinking, that's kind of a weird type. What sort of situation would that come under? A really common one is, for example, is saying whether something is on or off. So for example, if I want to make a variable that represents whether my light is on or off, I can say light_is_on and I can set this either to true or false. This is that new type, which is a Boolean. So if we want it to be true, to say yes, the light is on, we say capital True. And you'll notice, we don't put any double quotes around it. It's not a number, it's its own thing here. It's either capital…