What are the different built-in data types available in Python?

Some of the built-in data types available in Python are as follows:

  • Numeric types: These are the data types used to represent numbers in Python.
  • int: It is used for Integers
  • long: It is used for very large integers of non-limited length.
  • float: It is used for decimal numbers.
  • complex: This one is for representing complex numbers
  • Sequence types: These data types are used to represent sequence of characters or objects.
  • str: This is similar to String in Java. It can represent a sequence of characters.
  • bytes: This is a sequence of integers in the range of 0-255.
  • byte array: like bytes, but mutable only available in Python 3.x
  • list: This is a sequence of objects.
  • tuple: This is a sequence of immutable objects.
  • Sets: These are unordered collections.
  • set: This is a collection of unique objects.
  • frozen set: This is a collection of unique immutable objects.
  • Mappings: This is similar to a Map in Java.
  • dict: This is also called hashmap. It has key value pair to store information by using hashing.
Read the full book at www.amazon.com
Posted in Python, Python Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*