PythonByteSize
  • Home
  • Video Index
    • 1. The Basics
    • 2. Python Program Structures
    • 3. Python Operators
    • 4. Python Functions
    • 5. Introduction to Classes and Objects
    • 6. Python Strings
    • 7. User Defined Functions
    • 8. Classes and Objects
    • 9. Python Dictionaries
    • 10. Python tkinter
    • 11. Python Lists
    • 12. Python Namespaces
    • 13. Turtle Graphics
    • 14. Python Tips
    • 15. Complex Numbers
  • 1-Minute Videos
  • Exercise Index
    • 1. The Basics Exercises
    • 2. Python Program Structures Exercises
    • 3. Python Operators Exercises
    • 4. Python Functions Exercises
  • Donate
  • Computing Topics
  • Mathematics
  • Educators
  • Contact
  • About

Exercise 4.6 (Pythons type() function)


1. Ensure you have viewed the video (associated with this exercise) at this link >> 

2. Predict the output of the program below (Example 1).
Exercise 4.6 Example 1

    

3. Predict the output of the program below (Example 2).
Exercise 4.6 Example 2

    

4. Predict the output of the program below (Example 3).
Exercise 4.6 Example 3

    

5. A data structure that appears in code between the following type of brackets is referred to as what?
[ ... ]
6. A data structure that appears in code between the following type of brackets is referred to as what?
{ ... }
7. A data structure that appears in code between the following type of brackets is referred to as what?
( ... )
Note: I strongly recommend that you learn the meanings of these brackets as they apply to Python data structures.

8. In your own words describe the relationship between a class and an instance of the class.

9. Draw the execution space (as covered in the videos) for the following assignment statement:

x = 6.248

10. In your own words explain why the type() function always returns the word class. For example the following program:

w=65
print(type(w))

produces the following output:
​
<class 'int'>
>>>


END    Next Exercise >>

Please consider donating to help with the costs incurred in developing this website.             Donate >>