Identify the Type

Easy ⏱ 8 min 75% acceptance ★★★★★ 4.9
Write a function describe_type(value) that returns the name of the built-in type of value as a string (e.g. "int", "str", "list"). Use the built-in type() function rather than hardcoding checks.

Examples

Example 1
Input
describe_type(42)
Output
'int'
Explanation

42 is an integer literal.

Example 2
Input
describe_type([1, 2])
Output
'list'
Explanation

A square-bracket literal is a list.

Constraints

  • `value` can be any Python object.
  • Return the type name as a plain string, no angle brackets.

Topics

Variables & Data Typestype()

Companies

AmazonTCSInfosys

Hints

Hint 1

`type(value).__name__` gives the class name as a string.

Hint 2

Do not use isinstance chains — one line suffices.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.