string integer float

At a basic level data in Python is either a string, integer or a float

Integer
An integer is a whole number such as 4 or 6 or 3478
Integers are not surrounded by quote marks or speech marks
A negative whole number is an integer such as -45

Float
A float is any number with a decimal point such as 3.4 or 569.13
Negative decimal numbers are also floats in Python such as -2.25
floats are not surrounded by quote marks or speech marks

String
A string is any data that isn't an integer or a float.
Text is the most common string
Strings are surrounded by speech marks or quote marks

String Examples
("This is a string")
('This is a string')
("""
This is a string
""")

Note sometimes numbers are used inside a string speech marks or quote marks so they are treated as strings
("This is a string 345 23.4")


Comments