# Insights into Boolen

#1

What is boolean and what does Set the following variables to the corresponding values: my_int to the value 7 my_float to the value 1.23 my_bool to the value True mean?

#2

Boolean is a class of variable that can either be True of False. It's returned as the result of inequalities and similar other statements. For example, 5>3 would return True. So for this example, they want you to set the value of my_bool to True as you would set the other variables to a numeric value.

#3

dude i dont understand a single said that you said. why is there a need for variables and booleans, its meant for numeric values?

#4

haha ok, so Bolean values are necessary for multiple reasons, but basically they are a response when you compare two things (IE an inequality). It's use will be more clear when you learn loops and if/else statements, but they can also be used with characters as well as numeric.

Here's an example of using inequalities in loops http://introtopython.org/if_statements.html.

#5

There are many situation when we need to face Yes/No (decision based problem in life) problem.
Eg :
1. If my friend comes then I will play football.
2.I will keep giving test until i score above 90.
So you see decision based problems are part of real life (or programming).
We need these elements to solve decision based problems.
so Real life YES/NO corresponds to True/False in programming.
Boolean data types are basically used in following programming elements :
1.If statements
2.Loops
You will understand significance of Bool data types when you will meet (1) and (2).

#6

I even cant see where the problem is in my code look:
my_int = 7
my_float = 1.23
my_bool ="True"
if isinstance(my_int, int) and my_int == 7
print="my_int:%d" %my_int
if isinstance(my_float, float) and my_float == 1.23
print="my_float:%d" %my_float
if my_bool="True"
print="my_bool:%s" my_bool

#7

A post was split to a new topic: Boolean

#8