Description: Python has several basic data types that are essential for storing and manipulating data.
Step-by-Step Process
String(str) Types: A sequence of characters enclosed in quotes (either single ' or double ")
Number Types: integer(int): It stores the numberic values both positive and negative but not decimal. float: It stores the numbers with decimal values. complex: It stores the numbers with real and imaginary parts
Sequence Types: list: List is a collection of items which can be of different type.List is Ordered and Mutuable. List can be wriiten with Square bracket[]. tuple: Tupleis a collection of items which can be of different type.Tuple is Ordered and Immutable. Tuple can be wriiten with parenthesis(). sets: Set is a collection of an unordered unique items which does not allow duplicate values.Set can be written with curly braces{}.
Mapping Type: Dictionary(dict): Dictionary is an unordered collectioof key-value pairs.In Dictionary, each key is unique. Boolean Type(bool): It represents a boolean value either True or False.
Sample Code
#String
#Single-Quated
name = 'Praveen'
#Double-quoted
name2 = "Kumar"
#Number Types
#Integer
Age = 55
#Float
ratings = 97.8
#Complex
value = 7+8j
#Sequence Type
#List
list1 = [18,24,"Fruits"]
#Tuple
tuple1 = (1, 2,"Fruits")
#Set
fruits = {"apple", "banana","Cherry"}
#Mapping Type
person = {"name": "Alice", "age": 25}
#Boolean Type
Bool1 = True
Bool2 = False
print("Output for all data types:")
print(type(name))
print(type(name2))
print(type(Age))
print(type(ratings))
print(type(value))
print(type(list1))
print(type(tuple1))
print(type(fruits))
print(type(person))
print(type(Bool1))
print(type(Bool2))