Computer Science for Beginners
Lesson 1: Introduction to Computer Science
Lesson Date: 2024-06-23
Topics Covered
- PB&J
- History of Computer Science
- Algorithms
- Definition: A series of steps or instructions to accomplish a task. Simple Wikipedia: Algorithm
- Examples of real-life algorithms:
- Maps with turn-by-turn driving directions.
- Recipes for baking cookies.
- What would happen if you followed the instructions, but out of order?
- Modern Computers
- Early Communication
- Counting and Number Systems
- Arabic numbers, decimal system (base 10). Simple Wikipedia: Decimal
- Humans have 10 fingers and toes, hence base 10.
- Digits explained.
- For example, the number 1492 can be broken down as follows:
- (1 \times 10^3 = 1000)
- (4 \times 10^2 = 400)
- (9 \times 10^1 = 90)
- (2 \times 10^0 = 2)
- Adding these together, (1000 + 400 + 90 + 2 = 1492).
- Binary System
- Binary digits (bits): Can be 0 or 1. Simple Wikipedia: Binary
- With one hand, you can count up to 31 (32 values including 0).
- Binary example:
- The binary number
1101
can be broken down as follows:
- (1 \times 2^3 = 8)
- (1 \times 2^2 = 4)
- (0 \times 2^1 = 0)
- (1 \times 2^0 = 1)
- Adding these together, (8 + 4 + 0 + 1 = 13).
- Powers of Two
- Here are the powers of two from (2^1) to (2^{32}):
- (2^1 = 2)
- (2^2 = 4)
- (2^3 = 8)
- (2^4 = 16)
- (2^5 = 32)
- (2^6 = 64)
- (2^7 = 128)
- (2^8 = 256)
- (2^9 = 512)
- (2^{10} = 1024)
- (2^{11} = 2048)
- (2^{12} = 4096)
- (2^{13} = 8192)
- (2^{14} = 16384)
- (2^{15} = 32768)
- (2^{16} = 65536)
- (2^{17} = 131072)
- (2^{18} = 262144)
- (2^{19} = 524288)
- (2^{20} = 1048576)
- (2^{21} = 2097152)
- (2^{22} = 4194304)
- (2^{23} = 8388608)
- (2^{24} = 16777216)
- (2^{25} = 33554432)
- (2^{26} = 67108864)
- (2^{27} = 134217728)
- (2^{28} = 268435456)
- (2^{29} = 536870912)
- (2^{30} = 1073741824)
- (2^{31} = 2147483648)
- (2^{32} = 4294967296)
- Story of Chess
- The inventor asked for 1 grain of rice, doubled each day for each square on a chessboard.
- Computer Architectures
- Early Gaming Systems
- Programming Languages
- Languages for This Course
- We’ll learn Python and JavaScript.
- Starting with Python because it’s easy.
- Later, JavaScript because it is pervasive and used on the web.
- Introduction to Python
- Python has an interpreter (REPL - Read Eval Print Loop). Wikipedia: REPL
- How code is interpreted, compiled, assembled.
- Introduction to:
- HTML and CSS
- Data Sizes
- 8 bits in a byte; half of a byte is a nibble.
- Power prefixes and their values:
- Kilo (K) = (10^3)
- Mega (M) = (10^6)
- Giga (G) = (10^9)
- Tera (T) = (10^{12})
- Peta (P) = (10^{15})
- Exa (E) = (10^{18})
Homework
- Set Up PC or Mac
- Create a GitHub Account
- Choose a professional-sounding username.
- Avoid using a personal picture or details if you’re a minor.
- Share your GitHub profile with the course instructor.
- Practice
- Reading / Watching
- Writing Programs
- Write a Python program that prints out the powers of 2 from 0 to 32.
- Implement the program using a for loop.
- Implement the program using a while loop.
- Figure out the ASCII Codes
- Find the ASCII codes for each letter in your first and last name. Use the provided ASCII table link.
Resources
Communication and Questions
- Submit any questions you have in our Slack workspace.
- The invitation link for Slack is included in the email to the class.
Reminders
- Use Slack primarily for communication, asking questions, and doing homework.
- Don’t forget to share your GitHub profile with the course instructor.