Thread Rating:
Computer Science Cheat Sheet — Quick Beginner Reference
#1
Computer Science Cheat Sheet — Quick Beginner Reference

A simple, clear reference sheet covering:
• basic programming ideas 
• Python fundamentals 
• logic & boolean operators 
• data types 
• key terms used in CS and coding 

Perfect for GCSE, A-Level, and new programmers learning science coding.

-----------------------------------------------------------------------

1. Key Programming Concepts

Algorithm 
A step-by-step method for solving a problem.

Variable 
A named storage location that holds a value.

Iteration 
Repeating code (loops).

Selection 
Making decisions (if statements).

Function 
Reusable block of code.

Debugging 
Finding and fixing errors.

-----------------------------------------------------------------------

2. Data Types (Python)

• int → whole numbers (3, 42, -7) 
• float → decimal numbers (3.14, 9.81) 
• str → text ("Hello") 
• bool → True or False 
• list → [1, 2, 3] 
• dict → {"key": value} 

-----------------------------------------------------------------------

3. Python Basics

Print text 
Code:
print("Hello")

Variables 
Code:
x = 5
name = "Johno"
speed = 12.5

Input 
Code:
name = input("Enter your name: ")

-----------------------------------------------------------------------

4. Math Operators

• + addition 
• − subtraction 
• * multiplication 
• / division 
• // integer division 
• ** power (x**2 = x²) 
• % remainder 

-----------------------------------------------------------------------

5. Boolean Logic (Essential for CS & Science)

Comparison Operators 
• == equal 
• != not equal 
• > greater than 
• < less than 
• >= greater or equal 
• <= less or equal 

Boolean Operators 
• and 
• or 
• not 

Examples: 
Code:
x > 3 and x < 10
x == 5 or y == 7
not (x == 0)

-----------------------------------------------------------------------

6. If Statements (Selection)

Code:
if x > 10:
    print("Big number")
elif x == 10:
    print("Exactly 10")
else:
    print("Small number")

-----------------------------------------------------------------------

7. Loops (Iteration)

For loop: 
Code:
for i in range(5):
    print(i)

While loop: 
Code:
while x < 10:
    x += 1

-----------------------------------------------------------------------

8. Lists (Very Important)

Code:
numbers = [3, 7, 1, 9]
numbers.append(5)
print(numbers[0])  # prints 3

-----------------------------------------------------------------------

9. Dictionaries (Useful for Data)

Code:
info = {
    "name": "Mia",
    "age": 15
}

print(info["name"])

-----------------------------------------------------------------------

10. Functions

Code:
def greet(name):
    print("Hello", name)

greet("Johno")

-----------------------------------------------------------------------

11. File Reading (Beginner Example)

Code:
with open("data.txt") as f:
    content = f.read()
    print(content)

-----------------------------------------------------------------------

12. Common Errors (Beginner Mistakes)

❌ Indentation errors 
✔ Always line up your code blocks

❌ Using = instead of == 
✔ = assigns values, == compares values

❌ Forgetting quotation marks around strings 
✔ "Hello", not Hello

❌ Mixing tabs and spaces 
✔ Always use spaces in Python

-----------------------------------------------------------------------

Summary

This cheat sheet covers the most important CS basics:
• variables 
• logic 
• loops 
• functions 
• data types 
• operators 
• Python syntax 

It’s everything a beginner needs to start coding confidently.
Reply
« Next Oldest | Next Newest »


Forum Jump:


Users browsing this thread: 1 Guest(s)