Articles → Python → Data Types In Python
Data Types In Python
What Are Data Types?
Different Types Of Data
- Integer → Any value that is
- A number
- Positive or negative
- Does not contain decimals
PositiveValue = 25
NegativeValue = -12
- Float → Any value that is
- A number
- Positive or negative
- Contains decimal
PositiveValue = 40000.35
NegativeValue = -40000.35
- String → It is the sequence of characters
string_with_single_quotes = 'value 1'
string_with_double_quotes = "value 2"
- Boolean → This data type has 2 permissible values i.e., true, or false
How To Access String Variables?
message = "Hello"
print(message[0])
print(message[1])
print(message[2])
print(message[3])
print(message[4])
Escape Characters In The String
- \n → Insert a new line between the string
- \t → Insert tab space between the string
message1 = "Hello \n world"
message2 = "Hello \t world"
print ("message1 is :", message1)
print ("message2 is :", message2)