| [ Web Proxy ] |
| Viewing: https://www.pythonbyexample.dev/examples/values | [Back] [Original] |
Basics
Start with several built-in values. Python does not require declarations before binding these names, and each value is still an object with a type.
Source
text = "python"
count = 3
ratio = 2.5
ready = True
missing = None
print(type(text).__name__)Output
strMethods and operators evaluate to new values. The original text, count, and ratio bindings remain ordinary objects you can reuse.
Source
print(text.upper())
print(count + 4)
print(ratio * 2)Output
PYTHON
7
5.0Boolean expressions combine facts, and None is checked by identity because it is a singleton absence marker.
Source
print(ready and count > 0)
print(missing is None)Output
True
TrueNotes
is None for the absence marker, not == None.str
PYTHON
7
5.0
True
True
Execution time appears here after you run the example.
| Web Proxy Viewer | New URL | Original Page |