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
- Wonder 2 Finally Shows Some Restraint January 25, 2026
- Forty-Five Bugs Hiding in Plain Sight January 23, 2026
- Cleaning the Metadata January 21, 2026