Easier Loops
March 04, 2018
I have found loops and lists quite difficult to follow so I've broken it down to something more simple; along with comments.
On the weather, most of the snow is melting quickly now as the temperatures move into positive figures.
#build an empty list
elements = []
#add numbers in the range 1-10 and append them to elements
for n in range(1, 11):
print "Adding %d to the list." % n
elements.append(n)
#loop through the list and print the numbers
for n in elements:
print "These are the numbers: %d" % n
Recent Entries
- Unarchived Memories December 17, 2025
- Fixing CloudFront HTTP/2 Configuration December 15, 2025
- Packets to a Silent Modem December 14, 2025