What is the point of the line my_boulion=True? I can't see a point to it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the point of the line my_boulion=True? I can't see a point to it.

I can also make it my_boulion ="dog" or my_boulion = 7

21st Oct 2016, 1:11 AM
Amanda Springer
Amanda Springer - avatar
5 Answers
+ 3
When you do my_boolean = True You assign the variable"my_boolean" as a Boolean type, and set its value to True if you do my_boolean = "dog" it will be string type my_boolean = 7 will be int type
21st Oct 2016, 2:24 AM
Adwait Bhope
Adwait Bhope - avatar
+ 1
you may want to initialize the state of that variable. that way you have a known starting point. the asumption is that later you would test it with the == operator
26th Oct 2016, 9:52 PM
Robin S
0
Can you specify the context?
21st Oct 2016, 2:15 AM
Adwait Bhope
Adwait Bhope - avatar
0
the control structures module on the very first page.
21st Oct 2016, 2:17 AM
Amanda Springer
Amanda Springer - avatar
0
Note that my_boolean = "True" will set the variable as a string type because of the inverted commas
21st Oct 2016, 2:26 AM
Adwait Bhope
Adwait Bhope - avatar