AP Computer Science Principles

Advanced Placement Computer Science Principles exploring computational thinking and programming.

Basic Concepts

Programming Basics

The Building Blocks of Programming

Programming is the process of giving instructions to a computer to perform tasks. These instructions are written in languages that computers understand, like Python or JavaScript.

Basic Concepts

  • Variables: Store information like numbers or text.
  • Data Types: The kind of information, like numbers (integers), text (strings), or true/false values (booleans).
  • Conditionals: Decisions in code, usually with if, else if, and else.
  • Loops: Repeat actions multiple times, using for or while statements.

Writing Your First Program

A simple program might ask for your name and greet you. It uses variables to store your name and prints a message.

name = input("What's your name?")
print("Hello, " + name + "!")

Why Learn Programming?

Programming helps you automate boring tasks, create games, build websites, and much more!

Examples

  • Creating a calculator that adds two numbers.

  • Making a quiz game that asks questions and checks answers.

In a Nutshell

Programming is writing instructions for computers to follow using special languages.

Key Terms

Variable
A container for information in a program.
Loop
A way to repeat actions in code.
Conditional
A decision-making statement in a program.