Python data types

types of datatypes

Python Immutable

  • Immutable data types are those that can never change their value in place.

Types of immutable data types are:

  • String
  • Numeric
    1. Integers
    2. Floating-Point
    3. numbers
    4. Booleans
  • Tuples

String

  • Strings are array.
  • The array is the collection of similar data types used in pythons.
The array always starts with 0 indexes.
Example

Use of for loop

a = "Hello, World!"

print(a)
Output
Hello, World

Access data from String

  • Colen (:) is used for accessing data from starting to last. but the last item is not included.
Example

Use of for loop

a = "Hello, World!"

print(a[1:5])
Output
ello