Introduction Variables Data Types Numbers Casting Strings Boolean Operators Lists Tuples Dictionaries If-Else While Loops For Loops Functions Arrays Scope Modules User Input File Handling Python Maths

Welcome to the lesson on Python Data Types

Data Types

A Data Type is something python automatically assigns to a variable, list , tuple or dictionary.

Here are a list of data types assigned to variables.

Example:

syntax
Try it out yourself

Identifying data types

The type() function can be used to identify the data type labeled to a variable.

Example:

syntax
Try it out yourself

Manual assignment of data types

In python, assignment of data types are automatic, however you can choose to do it manually too.

Examples:

Example Data type
str("hello") string
int(2) integer
float(2) float
complex(2j) complex
list(("monkey" , "cat" , "dog")) list
tuple(("monkey" , "cat" , "dog")) tuple
range(6) range
dict(name="chief" , age=30) dict
bool(x) bool

End of Python Data Types

You have learned Data Types in simple terms. Let's proceed on to Quiz.

Quiz Time!
Next Lesson
Back To Top