Articles → Python → Data Types In Python

Data Types In Python






What Are Data Types?





Different Types Of Data






PositiveValue = 25
NegativeValue = -12






PositiveValue  = 40000.35
NegativeValue  = -40000.35






message = "Hello world"




string_with_single_quotes = 'value 1'
string_with_double_quotes = "value 2"






isFlag = True



How To Access String Variables?




message = "Hello"
print(message[0])
print(message[1])
print(message[2])
print(message[3])
print(message[4])




Picture showing the output of accessing the string values in the loop



Escape Characters In The String




  1. \n → Insert a new line between the string
  2. \t → Insert tab space between the string


message1 = "Hello \n world"
message2 = "Hello \t world"

print ("message1 is :", message1)
print ("message2 is :", message2)




Picture showing the output of escape characters in string



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, January 31, 2019
 
Updated On  -  Tuesday, March 26, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250