Python Base Types - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript Python Base Types - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Wednesday, November 28, 2018

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.


code
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

Screenshot


1 comment:

Post Top Ad