Skip to content

Joseph-T-Gordon

A complete log of all recent projects and skills

Menu
  • About me
  • Posts/Projects
  • Resume/Certifications
Menu

Post #37 (Python Programming) – The power of loops in python

Posted on March 21, 2023June 26, 2023 by admin

There are two types of loops in python for loops and while loops. Here is a brief explanation of both and then an example. For the for loop the range command allow you to determine how long the loop will last or iterate through several values, start is where the value will begin, end is where it will end not including that value and step is how much it increments by.

while x is true:

do this thing

for i in range(start, end, step):

do this thing

Examples:

code:

x = 0

while x < 10:

print(x)

x += 1

Result:

0

1

2

3

4

5

6

7

8

9

code:

for x in range(1,11,2):

print(x)

Result:

1

3

5

7

9

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2025 Joseph-T-Gordon | Powered by Minimalist Blog WordPress Theme