2. Module 1 Python literals
Literals - the data in itself
123
โข one hundred twenty three!
C
โข the speed of light?
โข the constant of integration?
โข the length of a hypotenuse?
โข ...?
print("2")
print(2)
2
2
be stored in completely
different ways in the
computer's memory
3. Module 1 Python literals
Octal and Hexadecimal numbers
the number eleven
million one hundred and
eleven thousand one
hundred and eleven
11111111
11_111_111
negative numbers?
-11111111
-
11_111_111
octal
โข 0O or 0o prefix (zero-o)
hexadecimal
โข 0x or 0X prefix (zero-x)
5. Module 1 Python literals
Strings
โข Strings are used when you need to process text.
"I am a
string."
I like "Monty
Python"
print("I like "Monty Python"")
print('I like "Monty Python"')
6. Module 1 Python literals
Boolean values
False
0
No, this is false
True
1
Yes, this is true
print(True > False)
print(True < False)
7. Module 1 Python literals
Key takeaways
โข Literals are notations for representing some fixed values in code;
โข A binary number is made up of 0s and 1s only;
โข The numerical types: integers, floating-point numbers;
โข Using the escape character;
โข Boolean values: true & false
8. Module 1 Python literals
LAB Practice
3. Python literals-strings