Chapter 4: for Loops, Strings, and Tuples: The Word Jumble Game


Download CD Content

Overview

You've seen how variables are a great way to access information, but as your programs grow in size and complexity, so can the number of your variables. Keeping track of all of them can become a lot of work. Therefore, in this chapter, you'll learn about the idea of sequences and meet a new type, called the tuple, which let's you organize and manipulate information in ordered groups. You'll also see how a type you've already encountered, the string, is really a sequence too. You'll also learn about a new kind of loop that's built just for working with sequences. Specifically, you'll learn how to do the following:

  • Construct for loops to move through a sequence

  • Use the range() function to create a sequence of numbers

  • Treat strings as sequences

  • Use tuples to harness the power of sequences

  • Use sequence functions and operators

  • Index and slice sequences




Python Programming for the Absolute Beginner
Python Programming for the Absolute Beginner, 3rd Edition
ISBN: 1435455002
EAN: 2147483647
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net