View on GitHub

St. Marina Coding Class

Programming & Computer Architecture lessons

Chapter 1 — Getting Started with Python

Welcome to your first coding lesson!
Before we write our first program, let’s talk about some basics.


Programming Languages

A programming language is how humans “talk” to computers.
Just like people have English, Spanish, or Arabic, computers have languages like Python, Java, and C++.
Each language has its own rules, called syntax.


What is Syntax?

Syntax is like grammar in English.
If you don’t follow grammar, a sentence doesn’t make sense.
If you don’t follow syntax, the computer will give you an error.


Functions

A function is a small piece of code that does one job.

Example (don’t worry if this looks confusing yet):

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

Here, def starts the definition of a function called greet. Inside it, we used print — a built-in function in Python.


The print Function

print is one of the most important functions you’ll use in Python. It tells the computer: “Show this text as output on the screen.”

Example:

print("Hello, world!")

When you run this program, you’ll see:

Hello, world!

More Print Examples

You can print many things:

print("My name is Sarah")
print(2 + 3)
print("The result is:", 2 + 3)

Output:

My name is Joseph
5
The result is: 5

Notice:


Summary

At the bottom of this page, you’ll find your assignment link. Try writing your own print statements!


Assignment

Click Here to Do Assignment 1 on GitHub Classroom