Stuck at boolean


I am very new to coding but its a faciating skill that i wil love to master..i am currently stuck at boolean pretty much the second task in python Set the following variables to the corresponding values: my_int to the value 7 my_float to the value


You will want to assign the variable my_int to 7. In this case your code would look like

my_int = 7

You would repeat this with my_float as well. If they want a boolean, it would look like:

my_float = false


i coded

but its not working the, here is the results......
Traceback (most recent call last):
File "python", line 2, in
NameError: name 'true' is not defined

int    =>  Integer
float  =>  Real
bool   =>  Boolean

Python integer  =>  -99, -1, 0, 1, 99
Python float    =>  -99.1, -1.0, 0, 1.1, 9.90
Python boolean  =>  True, False


here is the second result when i code following this instructions below

result is Traceback (most recent call last):
File "python", line 3, in
NameError: name 'true' is not defined

not sure why its not working.....thanks for your help


Check my previous post, the booleans.


thanks for the help, how would you put it in a code ?
i did enter your what you wrote but the result was the same ?


The way you have, just with the correct (valid) token: True or False.

Style guide note:

White space is free, and very helpful if we use it consistently.

my_bool = False

The space on either side of the operator is recommended in most style guides. It lets the operator stand out for better readability.


I know I feel stupid just because I don't know what to do.


Lol i feel a little stupid not sure... why its not working following your intructions.
my_int= 7
my_float= 1.23
my_bool= true or flase..

here is below the result, am not sure what am doing wrong.

Traceback (most recent call last):
File "python", line 3, in
NameError: name 'true' is not defined


Python bool type includes only , False, or, True. The capital is important.


thanks so much, it worked... my_bool=True or False
the result is NONE


That may be ignored It is console behavior that hasn't been filtered out.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.