What would be the output of the following Python code? print(type([]))
- <class 'str'>
- <class 'list'>
- <class 'int'>
- <class 'tuple'>
The output of type([])
would be <class 'list'>
because the empty square brackets []
represent an empty list, so the type() function returns <class 'list'>.
Loading...
Related Quiz
- A Python script unexpectedly terminates, and upon investigation, you discover a circular import. What could be a probable solution?
- You are developing a Python application and suspect a memory leak. Which tool or technique would you use to identify and analyze the memory consumption?
- You need to normalize a NumPy array so that the values range between 0 and 1. How would you achieve this?
- How can you access the sqrt function from the math module?
- Your application needs to write user data into a file. To ensure data consistency, even if the application crashes during a write operation, what measure would you take?