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?
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.
dude i dont understand a single said that you said. why is there a need for variables and booleans, its meant for numeric values?
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.
There are many situation when we need to face Yes/No (decision based problem in life) problem.
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 :
You will understand significance of Bool data types when you will meet (1) and (2).
I even cant see where the problem is in my code look:
my_int = 7
my_float = 1.23
if isinstance(my_int, int) and my_int == 7
if isinstance(my_float, float) and my_float == 1.23