Python 101

Python Datatypes

KoshurAI
2 min readDec 26, 2022

In Python, there are several built-in data types that you can use to store and manipulate data. These data types include:

  1. Integers: Integers are whole numbers that can be positive, negative, or zero. For example, 10, -5, and 0 are all integers. In Python, integers are represented using the int data type.
  2. Floating-point numbers: Floating-point numbers are numbers that have a decimal point. For example, 3.14, -0.01, and 0.0 are all floating-point numbers. In Python, floating-point numbers are represented using the float data type.
  3. Strings: Strings are sequences of characters, such as words or phrases. In Python, strings are represented using the str data type. Strings can be enclosed in single quotes (') or double quotes ("), but the quotes must match.
  4. Booleans: Booleans are data types that can have only one of two values: True or False. In Python, Booleans are represented using the bool data type.
  5. Lists: Lists are ordered collections of items. Lists can contain items of any data type, including other lists. In Python, lists are represented using square brackets [].
  6. Tuples: Tuples are similar to lists, but they are immutable, which means that they cannot be modified after they are created. Tuples are represented using parentheses ().
  7. Sets: Sets are unordered collections of unique items. In Python, sets are represented using curly braces {}.
  8. Dictionaries: Dictionaries are collections of key-value pairs. In Python, dictionaries are represented using curly braces {}.

Each of these data types has specific properties and methods that you can use to manipulate and access the data they contain. For example, you can use the len() function to get the length of a string, list, tuple, or dictionary, or you can use the sort() method to sort the items in a list.

--

--

KoshurAI
KoshurAI

Written by KoshurAI

Passionate about Data Science? I offer personalized data science training and mentorship. Join my course today to unlock your true potential in Data Science.

No responses yet