Jump to content

what does the True do in python?

1832vin

i've been wondering, i know how to use it, but what does it actually mean, and what odes it do?

Link to comment
Share on other sites

Link to post
Share on other sites

It's a boolean value, so you can use it as a marker for condition-checking purposes.  For example, you write two paths for a program, depending on whether a condition is true or false.

 

if (Logged_In == true)

#Display Logout button

 

elif (Logged_In == false)

#Display Login button

 

Or did I misunderstand the question?

Link to comment
Share on other sites

Link to post
Share on other sites

It's a boolean value, so you can use it as a marker for condition-checking purposes.  For example, you write two paths for a program, depending on whether a condition is true or false.

 

if (Logged_In == true)

#Display Logout button

 

elif (Logged_In == false)

#Display Login button

 

Or did I misunderstand the question?

no, thankyou, you got the question right, sorry for the vague question asking

Link to comment
Share on other sites

Link to post
Share on other sites

In accordance to the syntax one can simply write:

if something:    print("True")else:    print("False")

Or ternary:

print("True") if something else print("False")

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×