M&M 1
Year: Aviation ENG 2
,Table of Contents
Summary of Aircraft Perspective M&M 1 1
Week 01: Introduction to Math and Modelling 3
Programming Languages and Algorithms 3
Components of a Computer 4
Boolean Logic 6
Week 02: Pseudo-Code & Flow Charts 7
Programming Language 7
Algorithm 7
Pseudocode 8
Primary constructs of Pseudo-Code 8
Flowcharts 11
Week 03: Solving for One Variable 12
General math 12
Python operators 13
Week 04: Python Variables and Operators 14
Variables 14
Strings 14
Casting 15
Methods and Printing 15
String Methods 15
Slicing Strings 16
The input() Function 16
Arithmetic Operators 17
Comparison Operators 18
Overview of Comparison Operators 18
Week 05: Python Functions 19
Functions in python 19
Tuples en Sets 19
Lists 21
Modifying Lists (Mutable Behavior) 22
Lists in Mathematical Applications 22
Dictionaries 23
Intervals 25
Week 06: Loops & Conditionals 26
For Loops (Definite Iteration) 26
The range() function explained 26
Why for-loops are useful 27
While Loops (Indefinite Iteration) 27
Summary of the loops 28
Conditionals (If / Elif / Else) 29
Using if, elif, and else 29
Logical operators 29
Extra examples from presentation slides 30
2
, Week 01: Introduction to Math and Modelling
Programming Languages and Algorithms
From Programming Language to Machine Code
In a programming language such as Python, instructions are written in a relatively
readable form. These instructions are then translated into machine code. This
translation can happen in two ways:
- Compiler: The entire program is first translated into machine code, after which it
can be executed as a whole.
- Interpreter: The code is read and executed line by line. Python works this way,
which means errors such as spelling mistakes or incorrect commands become
immediately visible through error messages.
Program Structure
Every computer program follows a certain structure. In its simplest form, it consists of
three parts:
I. Start of the program: a starting point indicating that the instructions follow.
II. Variable declarations: where you define the data or symbols you will use (e.g.,
variables such as speed or distance).
III. Program instructions: the actual commands, organized into blocks of code. A
computer typically executes these blocks step by step, in sequence.
Algorithms
An algorithm is simply a step-by-step method for solving a problem. You can think of it
as a recipe: a series of clear instructions that, when followed correctly, lead to the
desired result.
Example: Suppose you want to find the largest number in a sequence. A simple
algorithm would be:
1. Take the first number as the starting value.
2. Compare it with the next number.
3. If the new number is larger, replace the current value with this number.
4. Repeat this until all numbers have been compared.
5. The remaining number is the largest.
3