> For the complete documentation index, see [llms.txt](https://gilmour.online/compsci/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gilmour.online/compsci/archives/adiletta-archives/itp/3-hello-python.md).

# OLD: Parts of Python (old -- Mr. A)

## Expectations <a href="#expectations" id="expectations"></a>

We're going to take a tour of Python. You are expected to know generally *what* these things are, you're not yet expected to know *how* to use them. So no freaking out. We'll play around with some fun projects after a quick look around.

### Learning Targets <a href="#learning-targets" id="learning-targets"></a>

* I can make a hello world app in Python.
* I can differentiate between compile-time, run-time, and logic errors.
* I can describe the basic constructs of programming languages such as variables, conditionals, loops, and flow control.

### Assessments <a href="#assessments" id="assessments"></a>

* You will be answering comprehension questions about the layers supporting software execution.
* You will be creating and submitting your first Python app using trinket.io

Let's go to trinket.io and build some simple stuff, starting with `print("Hello, world")`

We'll go over each of these concepts in greater detail. For now, let's skim over all the big topics.

## Data Types

The first thing we'll tinker with is **declaring** variables and storing information. Variables in Python are **dynamically typed**, meaning you can store one type of information in a variable and then switch it without any fuss. Other languages are more strict and don't allow such shenanigans.

![](/files/-LKwQMm38Zu3WI3-_ii1)

## Operations

{% embed url="<https://www.loom.com/share/7221399afc924044a959c978c98cd0c2>" %}

We use math symbols for most common operations. But Python has some cool operators. Read!

{% embed url="<https://www.tutorialspoint.com/python/python_basic_operators.htm>" %}

![Yeah, reading. Push yourself to skim tech guides so you know what's availabe.](/files/-LmdqY_Symzy3kQBfH1i)

## Conditionals

{% embed url="<https://www.loom.com/share/f3fe6e11cf2747df976bd2dc9abb09c7>" %}

Now we're switching from declarations and operations to control flow. Now we can direct the computer's train of thought (aka its **thread**).

![](/files/-LKwQ8RrEwuKmvPxe-4d)

![](/files/-LKwQEAsIh9YrHtYH4JV)

![](/files/-LKwQGk6hAqc8GCD_v71)

## Loops

{% embed url="<https://www.loom.com/share/792db98c565545dcb7bf34f61d85016b>" %}

This is how we repeat commands and **iterate** through a list or collection of items. Imagine you're using your hand to flip through posters at Walmart. Your hand selects each poster as it **traverses** the collection. That makes your hand the **iterator** as it is connecting with each object in the collection during the loop.

![](/files/-LKwQSvGZ-lqPTiwpYov)

![x in this loop is the iterator as it's the variable that traverses the collection](/files/-LKwQW3iEKug1cXk4hap)

![](/files/-LKwQXvNCCd2cGycJveH)

![](/files/-LKwQ_LCv32EQCVhXLOV)

![](/files/-LKwQbDHEfMfXRIku3kk)

![](/files/-LKwQd1QdWDIg_o9n-PC)

## Functions/Methods

A function is a set of commands you can call. When activating this "magic spell" you can pass it parameters or ingredients.

![the "return" keyword is a big one](/files/-LKwQnpweBo40kn1kbwt)

![](/files/-LKwQqjHkCaz_uR6BfyN)

![Whoa, combining concepts!](/files/-LKwQs1wfHr0u4OGF0y9)

![](/files/-LKwRFeO27pV9akZdrv6)

## Classes

{% hint style="danger" %}
This concept is pretty advanced. It's here as a reference point because exposure to these ideas is good (so long as you know that it's not something you need to master quite yet).
{% endhint %}

A class is how you can create your own objects. You can make an class serve as a single worker like a static library of mathematical operations or you can design your own object, like a Spaceship that can be spawned or instantiated into a game many times. It'll have its own instance variables like health and shield properties.

![](/files/-LKwQx30SdQ3qobheIqF)

![](/files/-LKwQydmq9Mz0aIjsDjU)

![](/files/-LKwR-AaP9hkl3KVYo_8)

![](/files/-LKwR0z_Oo6-5G97r5Ei)

![](/files/-LKwR2BIszg-7pgLMfFi)

![](/files/-LKwR0z_Oo6-5G97r5Ei)

![](/files/-LKwR9zwvk0ym9QFHzWy)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gilmour.online/compsci/archives/adiletta-archives/itp/3-hello-python.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
