lesson 08 Variables & Data Types · beginner
Text, True, and False
Text in a name is still text. True and False are the two yes-or-no values.
You'll be able to
- Store text in a name and print the name
- Store True or False and print it
- Tell True from the text "True"
The idea
Text in quotes is a value you can store. The quotes mark the text. They are not stored. item = "Train Set" and then print(item) shows Train Set.
Run each example to see what it prints. Running examples doesn't count toward progress.
example-1.py · Text in a name
item = "Train Set" code = "WELCOME10" print(item) print(code)
True and False are values, like numbers. They answer yes-or-no questions: is it in stock, has it shipped. They are written without quotes, and the capitals matter. true is not True. "True" is text, not the yes-or-no value. Using them to choose a path comes later. Here you store them and print them.
example-2.py · Yes and no
ready = True print(ready) print(False)
Review
- Text is stored in quotes. The quotes are not part of the value.
- True and False are values. They have no quotes, and the capitals matter.
- "True" is text. True is the yes-or-no value. Next: turning text into numbers.
Practise this