---
title: "type"
space: "Student Handbook"
url: "https://portal.cs17.org/student-handbook/python-manual/built-in-functions/type"
updated: "2026-10-05"
---

Tells you the type of a value.

## Synopsis

```python
type(value)
```

## Description

Use `type` when a value does not behave the way you expect. It is a debugging tool.

## Parameters

| Name | Meaning |
| --- | --- |
| `value` | Any value. |

## Return value

The type, shown as `<class 'int'>`, `<class 'str'>` and so on.

## Example

```python
print(type(42))
print(type("42"))
print(type(4.2))
print(type(True))
print(type([1, 2]))
```

It prints:

```text
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
<class 'list'>
```

## Common mistake

```python
x = input("Number: ")
print(type(x))
```

It prints:

```text
Number: 5
<class 'str'>
```

Not an error, but a surprise: the user typed a number, yet `x` is a string. `input` always returns `str`.

## See also

[input](/student-handbook/python-manual/built-in-functions/input), [int](/student-handbook/python-manual/built-in-functions/int), [str](/student-handbook/python-manual/built-in-functions/str)

[type in the Python documentation](https://docs.python.org/3/library/functions.html#type)
