When you’ve been programming for a while, you understand how to do it, but forget and confuse the syntax between languages. It is helpful then to a reference program that reminds you of some simple syntax for the language of the day.
This program shows print statements, procedure definitions and two types of for loops

#global variable for a list
colours = ["red", "green", "blue"]
def forLoopThroughRange(count):
for x in range(count):
print(x)
def forLoopWithList(myList):
for item in myList:
print(item)
def simpleWhileLoop(count):
i = count
while i < 6:
print(i)
i += 1
print("This is a simple program that demonstrates common syntax")
forLoopThroughRange(10)
forLoopWithList(colours)
simpleWhileLoop(3)
#global variable for a list
colours = ["red", "green", "blue"]
def forLoopThroughRange(count):
for x in range(count):
print(x)
def forLoopWithList(myList):
for item in myList:
print(item)
def simpleWhileLoop(count):
i = count
while i < 6:
print(i)
i += 1
print("This is a simple program that demonstrates common syntax")
happy = True
forLoopThroughRange(10)
forLoopWithList(colours)
simpleWhileLoop(3)
if happy:
print("The end")
When you run it, it looks like this
This is a simple program that demonstrates common syntax
0
1
2
3
4
5
6
7
8
9
red
green
blue
1
2
3
The end
See other Python Basics topics.