The Littleendian Method
87 128 0 87 64 1 23 32 0 23 16 1 7 8 0 7 4 1 3 2 1 1 1 1 0 0b1010111 87 87 *1 43 *11 21 *111 10 *0111 5 *10111 2 *010111 1 *1010111 0 1010111 87 87%5 = 2 *2 17 17%5 = 2 *22 3 3%5 = 3 *322 0 322 3*25 + 2*5 + 2 = 75 + 10 + 2 = 87
Packing-Unpacking Procedure
117 base 2: 0b1110101 base 8: 0o165 Packing: break into 3s fromthe little end. 1 110 101 Translate the pieces into octal 1 6 5 → 0o165 0o165 001 110 101 Hexadecimal number (base 16) {0, 1, 2, 3,4, 5, 6, 7, 8, 9, A, B, C, D, E, F} alphabet 0b1011010101010110 0b 1011 0101 0101 0110 B 5 5 6 → 0xB556. 0xB64 B 6 4 1011 0110 01000 0b101101100100
A Base Changing Practicepalooza
Hex Numbers and Colors Download colorDemo.zip from the navigation bar on the left. Decompress it and open the files with VSCode. Look in the CSS file, and you will see this.
/*Author: Morrison*/
h1, h2, .display
{
text-align:center;
}
body
{
background-color:#FFFFFF;
}
Change the 6-digit hex number inside of the body
style rule. Then, in your browser, choose File → Open... and
open the HTML file. Let's pool our knowledge.
red | FF0000 | |
---|---|---|
green | 00FF00 | |
blue | 0000FF | |
yellow | FFFF00 | |
black | 000000 | |
white | FFFFFF | |
magenta | FF00FF | |
magenta | 00FFFF | |
dookbloo | 001A57 |
Playing with Pythons
What is an object? An object is an item stored in memory. Objects have three attributes.
- state: This is what an object KNOWS.
- identity: This is what an object IS.
- behavior: This is what an object DOES.
All data in Python are represented as objects. Python, like every other language, has a type ecosystem. In this portion of the course, we will being by learning about Python's scalar types. Later, we will address sequences, sets, and dictionaries.