Python 101 (part 3): A Twist In The Tail (
Page 1 of 8 )
Find out more about adding flow control to your Python programs
with the "for" and "while" loops, see how the range() function can be used
to generate number ranges, and learn all about list objects. And bring an
old flame along for the ride.Last time out, I taught you a little bit about two of Python's basic data
types, strings and numbers. I also gave you a crash course in Python
operators and expressions, and demonstrated how they could be used in
conjunction with the "if" family of conditional statements to add control
routines to your Python programs.
However, "if" statements are only one piece of the jigsaw; Python also
allows you to control program execution with the "while" and "for" loops,
which coincidentally also happen to be the subject of today's discussion.
Along the way, I'll be demonstrating yet another of Python's built-in data
structures, visiting the Superhero Hall Of Fame, hooking up with some old
flames, and examining prime numbers and factorials.
Let's get started, shall we?