📘
Type Checker
EasyPython Basics
Problem Statement
Identify the types of different Python values.
Background
Python has several built-in types:
- int - integers (1, 42, -5)
- float - floating point numbers (3.14, 2.0)
- str - strings ("hello", 'world')
- bool - booleans (True, False)
- list - ordered collections ([1, 2, 3])
- dict - key-value mappings ({"a": 1})
Your Task
Write a function get_types(values) that takes a list of values and returns a list of their type names as strings.
Output Format
Return a list of type names (e.g., ["int", "str", "float"]).
Example:
Input:
[42, 'hello', 3.14, True, [1,2], {'a': 1}]Output:
['int', 'str', 'float', 'bool', 'list', 'dict']
Reasoning:
type(42).name returns 'int', type('hello').name returns 'str', etc.
Constraints:
- Use type() function
- Return type name as string using name
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.