Back to Module 2

Values

Values are the basic pieces of data in Python.

Common value types:

  • Strings: text
  • Integers: whole numbers
  • Floats: decimal numbers
  • Booleans: True or False
  • None: no value

Strings

greeting = "Hello, world!"
name = 'Python'
"9" + "3"      # "93"
"9" + 3        # TypeError

Integers and floats

count = 7
price = 3.5

count + 1
price * 2
7 / 2
7 // 2

Booleans and None

5 > 3
2 == 4
True and False

result = None
print(result)

Practice

text = "apple"
number = 10
decimal = 2.5
is_ready = True
empty = None

print(text)
print(number)
print(decimal)
print(is_ready)
print(empty)

Next: Variables