chapter1

__//Data types and data structures //__ In this chapter, we saw the use of the assignment using operator =, numeric addition using + (with type-promotion of an int to a float), and augmented assignment with +=.We also saw the print operator and learned that since IDLE automatically prints expressions, we use print much less often when using IDLE.We also saw that comments are introduced by a # and continue until the end of the line. In fact Python can separate statements with semicolons but it is very unusual to do this:In Python,a statement occupiesa single line; newline is the statement separator.

 We have learned how Python strings are created by using quotes, and how strings can be sliced and concatenated using the [] and + operators. We also summarized some of the key methods that Python strings provide:We will see numerous examples of their use in working code throughout the book. We saw that QString is a distinct Unicode string type and that we need to have a policy governing our use of QStrings and Python strings (normally unicode strings)when programming using PyQt.

 The chapter introduced Python’s major collection types. Tuples provide a nice way of grouping items together and can be used as dictionary keys. Lists are ordered and can hold duplicates. They provide fast insertions and deletions,and fast index-based lookup. Dictionaries are unordered and have unique keys. Like lists, they provide fast insertions and deletions. They also provide fast key-based lookup. Sets can be thought of as dictionaries that don’t hold values. We will make great use of all these types in the rest of the book.

 Finally, we had a quick glimpse at some of Python’s built-in functionality and at one of its mathematics modules. In Chapter 3, we will see how to create our own modules. But before that, we need to learn about Python’s control structures so that we can branch, loop, call our own functions, and handle exceptions—all of which are the subject of the next chapter

. To know about these data types,you can visit the following link: http://www.devshed.com/c/a/Python/Data-Types-in-Python/ **To know about these collections,you can also visit the following link http://www.devshed.com/c/a/Python/Data-Structures-in-Python-Lists-and-Tuples