0% found this document useful (0 votes)
2 views3 pages

Python Data Types: Integers, Floats, Booleans, Complex

The document explains various data types in Python, including integer, float, boolean, and complex numbers. It highlights that while integers can be represented in multiple numeral systems (decimal, binary, octal, hexadecimal), floats can only be represented in decimal form, including exponential notation. Additionally, it notes that boolean values are represented as True and False, and complex numbers consist of a real part and an imaginary part, with specific representation rules for each.

Uploaded by

Cloud training
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Python Data Types: Integers, Floats, Booleans, Complex

The document explains various data types in Python, including integer, float, boolean, and complex numbers. It highlights that while integers can be represented in multiple numeral systems (decimal, binary, octal, hexadecimal), floats can only be represented in decimal form, including exponential notation. Additionally, it notes that boolean values are represented as True and False, and complex numbers consist of a real part and an imaginary part, with specific representation rules for each.

Uploaded by

Cloud training
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Being a programmer, we can specify literal values in decimal, binary, octal and hexa decimal forms.

But PVM will always provide values


only in decimal form.

a= 10
b=0o10
c=0X10
d=0B10
print(a) 10
print(b) 8
print(c) 16
print(d)2
Python - Class 04( Python)
Date: 18th June 2024
By - Shyam Singh

We can use float data type to represent floating point values(decimal values)
e.g. f = 1.234
type(f) float

We can also represent floating point values by using exponential form (Scientific Notation)
e.g. f = 1.2e3 -> instead of 'e' we can use 'E'

Float Data Type

The main advantage of exponential form is we can represent big values in less memory.

We can represent int values in decimal , binary, octal and hexa decimal forms. But we can
represent float values only by using decimal form.
We can use this data type to represent Boolean values.

The Only allowed values for this data type are : True and false.
bool Data Type

Internally Python represent True as 1 and False as 0.


b=True
type(b)

A complex number is of the form


a+bj , a= Real Part and bj= Imaginary Part.

'a' and 'b' contain Integer OR Floating Point Values.

Complex Data Type

In the real part if we use int values then we can specify that either by
decimal,octal,binary or hexa decimal form.

But imaginary part should be specified only by using decimal form.

Even we can perform operations on complex type values.

You might also like