CodeCrate

Notes & Practice for K–12 Coders

πŸŽ’ Welcome to CodeCrate!

Learn coding one concept at a time.

πŸ’‘ Tip of the Day: Bugs are part of learning β€” don’t be afraid to fix them!

Variables

If/Else

Loops

Arrays

Functions

Code Challenges

Coding Stories

Glossary

Debugging Tips

Achievements

My Notes

Progress Tracker

Share

Feedback

Variables – What Are They?

A variable is like a box that stores something. You give it a name and put a value in it.

Example Code:

x = 10
print(x)

Challenge Quiz! πŸ€”

Q: What does x = 10 mean?

  • A) It compares x to 10
  • B) It prints x and 10
  • C) It stores 10 in x

βœ… C) It stores 10 in x

If/Else – Making Decisions

If/Else helps your program choose what to do based on conditions.

Example Code:

age = 12
if age > 10:
    print("You're older than 10!")
else:
    print("You're 10 or younger.")

Challenge Quiz! πŸ€”

Q: What will this print if age = 12?

  • A) You're 10 or younger.
  • B) Nothing.
  • C) You're older than 10!

βœ… C) You're older than 10!

Loops – Repeat with Power!

Loops let your program repeat actions to save time.

Example Code:

for i in range(3):
    print("Hi!")

Challenge Quiz! πŸ€”

Q: How many times will "Hi!" be printed?

  • A) 1
  • B) 3
  • C) 5

βœ… B) 3

Arrays – Storing Many Things

An array (or list in Python) stores multiple values in one place β€” like a basket of fruits.

Example Code:

fruits = ["apple", "banana", "cherry"]
print(fruits[1]) # Accessing the second item (index 1)

Challenge Quiz! πŸ€”

Q: What will this print?

  • A) apple
  • B) banana
  • C) cherry

βœ… B) banana

Functions – Reusable Code Blocks

A function is like a mini-program you can call anytime to perform a specific task.

Example Code:

def greet():
    print("Hello!")

greet() # Calling the function

Challenge Quiz! πŸ€”

Q: What will this print?

  • A) greet
  • B) Nothing
  • C) Hello!

βœ… C) Hello!

Code Challenges

Try these challenges on your own! You can use an online Python editor like Replit.

  • Challenge 1: Write Python code to print the numbers from 1 to 5.
  • Challenge 2: Create a Python function called `square` that takes a number as input and returns its square (the number multiplied by itself).
  • Challenge 3: Write Python code that asks the user for a number and then prints whether the number is even or odd. (Hint: Use the modulo operator `%`).

Fun Coding Stories

Ada and the Magic Loop πŸͺ„

Ada wanted to draw 10 stars. Instead of drawing them one by one, she used a magic `for` loop! The loop repeated the star-drawing spell 10 times instantly. ✨

Lesson: Loops make life easier by automating repetitive tasks!

Leo’s Lost List 🧺

Leo had a list of his favorite toys: `toys = ["robot", "car", "block"]`. He wanted the car, but forgot where it was! He remembered lists start counting from 0, so the car was at index 1: `toys[1]`. πŸš—

Lesson: Arrays (lists) help you store and find many items easily!

Coding Glossary

  • Variable: Stores a value (like a number or text) with a name.
  • Loop: Repeats a block of code multiple times.
  • Function: A named block of reusable code that performs a task.
  • Array (List): Holds multiple values in an ordered sequence.
  • If/Else: Makes decisions in code based on whether a condition is true or false.
  • Print: Shows output (text, numbers, etc.) on the screen.

Debug Like a Pro

Everyone makes mistakes (bugs!) in code. Here's how to find and fix them:

  • Always use a colon : at the end of lines starting with if, else, for, def.
  • Use double equals == to compare if two things are equal (e.g., if age == 10:). A single equals = is for assigning values to variables.
  • Watch your indentation! Python uses spaces/tabs to group code. Mismatched indentation causes errors.
  • Use print() statements inside your code to see the values of variables at different points. This helps track down where things go wrong.

Your Achievements Wall

Celebrate your coding milestones!

Variable Master
Loop Pro
Function Wizard
Logic Hero
List Explorer

πŸŽ–οΈ Junior Python Pro!

(Complete all topics to earn)

My Notes

Write your own notes here!

(This is a visual section only - notes are not saved.)

Progress Tracker

Check off the concepts you've learned:

  • Variables
  • If/Else
  • Loops
  • Arrays
  • Functions

πŸŽ‰ You’ve completed the CodeCrate basics!

Share with Your Class!

Enjoying CodeCrate? Share it with your friends and classmates!

You can copy this website's link from your browser's address bar.

Or, create a QR code for easy sharing using a tool like:

QR Code Generator

Tell Us What You Think

Your feedback helps us make CodeCrate better!

Please share your thoughts using our feedback form: