Table of Contents
Python data types
Python Immutable
- Immutable data types are those that can never change their value in place.
Types of immutable data types are:
- String
- Numeric
- Integers
- Floating-Point
- numbers
- 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