2026-07-23
Misc - Programming Python

Page Title: Misc - Programming Python
Last Modified: 2026-06-29 12:44:40
Current Date: 2026-07-23 11:14:23 UTC

Python is a high-level, general-purpose programming language that emphasizes code readability, simplicity, and ease-of-writing with the use of significant indentation, "plain English" naming, an extensive standard library. Python supports multiple programming paradigms but with an emphasis on object-oriented programming and dynamic typing.

Guido van Rossum began working on Python in the late 1980s as a successor to the ABC programming language and since 2003 Python has consistently ranked among the top ten most popular programming languages in the TIOBE Programming Community Index

These are my Programming Forgets.
Due to the medication I take I do struggle at times to remember or differentiate between programming languages formats and their language comprehensions so I just place these simple steps here as code examples to help me remember.

These are my Programming Forgets

Due to the medication I take I do struggle at times to remember or differentiate between programming languages formats and their language comprehensions so I just place these simple steps here as code examples to help me remember.

Python Conditions and If Else statements
Python supports the usual logical conditions from mathematics:
Equals: a == b
Not Equals: a != b
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b
These conditions can be used in several ways, most commonly in "if statements" and loops.
					
a = 200
b = 33
if b > a:
	print("b is greater than a")
elif a == b:
	print("a and b are equal")
else:
	print("a is greater than b")
					
Python For Next Loop
A for next loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).
This is less like the for keyword in other programming languages, and works more like an iterator method as found in other object-orientated programming languages.
With the for loop we can execute a set of statements, once for each item in a list, tuple, set etc.
Here is a simple for-next which will print 0 to 5 as range(6) produces integers from 0 up to but not including 6 — i.e., 0,1,2,3,4,5. Python’s range(start, stop, step) is defined so the sequence includes start and stops before stop (stop is exclusive). That’s why for x in range(6): prints 0–5.
					
for x in range(6):
  print(x)
					

 

Python For Next Loop with break statement
A for next loop with break statement that 'breaks' the loop when the statement is true, in this case will print 0 to 3 and then break out of the loop
					
for x in range(6):
  print(x)
  if x == 3:
    break
					

 

Python For Next Loop with continue statement
A for next loop with continue statement that 'continue' the loop when the statement is true, in this case will print 0 to 3 then will print 'Hello, x is 3' and then the loop will continue printing 4 to 5
					
for x in range(6):
  print(x)
  if x == 3:
    print(f'Hello, x is {x}')
    continue
					

 

Python While Loop
A while loop we can execute a set of statements as long as a condition is true.
Here is a simple while which will print 0 to 5 and then exit the loop. The '<' (less than) means process the loop while x is less than 6 but not including 6
					
x = 0
while x < 6:
  print(x)
  x += 1
					

 

Python While Loop with break statement
A while loop with break statement that 'breaks' the loop when the statement is true, in this case will print 0 to 3 and then break out of the loop
Here is a simple while which will print 0 to 3 and then exit the loop.
					
x = 0
while x < 6:
  print(x)
  if x == 3:
    break
  x += 1
					

 

Python While Loop with continue statement
A while loop with continue statement will execute a set of statements as long as a condition is true.
in this case will print 1 to 3 then will print 'Hello, x is 3' and then the loop will continue printing 4 to 6
					
x = 0
while x < 6:
  x += 1
  print(x)
  if x == 3:
    print(f'Hello, x is {x}')
    continue

					

Copyright © 2002 to 2026