> For the complete documentation index, see [llms.txt](https://otd.gitbook.io/book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://otd.gitbook.io/book/module-2/programming-logic.md).

# Programming Logic

## Introduction

We now know how to make computers perform certain actions using the Python programming language, but is there a way to control how and when our code is executed?

The concepts of **programming logic** tell our computer which code to execute, and can also be used to express repetition of an action or group of actions; this logical statements prove to be very valuable when we want to control the exact behavior of our code.&#x20;

In this module, you will be introduced to several new Python tools including **For Loops, Logical Operators,** and **Conditional Statements.** Using these tools, you will be able to control the flow of your programs to achieve the desired output.


---

# 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:

```
GET https://otd.gitbook.io/book/module-2/programming-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
