Knowledge Base‎ > ‎Programming‎ > ‎Python‎ > ‎Python Reference‎ > ‎




student = True
graduated = False


Creates a variables with the value of True. Booleans can only be True or False. They may then be used in if statements and other places where expressions are used.


name = value


name - a legal variable name (must start with a letter, and can have numbers and underscores in them)

value - the value to store in the variable, either True or False


Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> student = True

>>> type(student)

<type 'bool'>

>>> if student:

...   print "hey, you're a student!"


hey, you're a student!