Midterm Project
Midterm Project
20/2/2025
Table of contents
1.Introduction.........................
........... 3
2.Body.....................................
..........4
2.1.Definition and
purpose..........................................4
2.2.How it is used in
programing ?..............................5
2.3.Example and Code
Snippets......................................6
relevance..............................7
3.Conclu-
sion...........................................8
4.References.............................
...9
Introdution
A for loop works by taking each item from
a sequence (one at a time) and assigning it
to a variable. Then, the code inside the loop
runs using that variable's value. This repeats
until all items in the sequence have been pro-
cessed.
Body
Definition:
Purpose:
- Lists:
python
(Python).
print(name)
Bob
Charlie
Real -life application or relevance
- Efficiency: They streamline repetitive processes, saving you from writing the
same code multiple times.
- Flexibility: They can be used to iterate through various data structures (lists,
tuples, strings, etc.) and control the number of iterations.
- Control: They provide you with the ability to manage the flow of your pro-
gram and execute specific actions for each element in a collection.
- Readability: Their clear syntax makes your code easier to understand and
maintain.
- URL: https://www.w3schools.com/js/js_loop_for.asp
- URL: https://docs.python.org/3/tutorial/controlflow.html#for-statements
URL:
https://www.khanacademy.org/computing/computer-programming/programmin
g/loops/a/introduction-to-loops