4.9. Exercises

4-1. Python Objects. What three values are associated with all Python objects?

4-2. Types. Which Python types are immutable?

4-3. Types. Which Python types are sequences?

4-4. type() Built-in Function. What does the type() built-in function do? What kind of object does type() return—an integer or an object?

4-5. str() and repr() Built-in Functions. What are the differences between the str() and repr() built-in functions and the backquote ( `` ) operator?

4-6. Object Equality. What do you think is the difference between the expressions type(a) == type(b) and type(a) is type(b)?

4-7. dir() Built-in Function. In Exercises 2-12 and 2-13, we experimented with a built-in function called dir() which takes an object and reveals its attributes. Do the same thing for the types module. Write down the list of the types that you are familiar with, including all you know about each of these types; then create a separate list of those you are not familiar with. As you learn Python, deplete the “unknown” list so that all of them can be moved to the “familiar with” list.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset