Python Base Types

Python Base Types

Base Types in Python

Every value in Python has a datatype. Since everything is an object in Python programming, data types are actually classes and variables are instance (object) of these classes.

Base Types

Integer, float, boolean, string, bytes.

int 783
int 0 #zero
int -192 #negative
int 0b010 #binary
int 0o642 #octal
int 0xF3 #hexa
float 9.23
float 0.0
bool True False
str "One\nTwo"
bytes b"toto\xfe\775"

Example :
a=10 #int
b=20.1 #float
abc="hello" #string
print a
print b
print abc



Post a Comment