0% found this document useful (0 votes)
13 views21 pages

Understanding Python Numeric Types

Uploaded by

wmskli241181
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)
13 views21 pages

Understanding Python Numeric Types

Uploaded by

wmskli241181
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

PYTHON

NUMBERS
There are three numeric types in Python:

Int Float complex


Examples
Examples
Int

Int, or integer, is a whole number, positive or


negative, without decimals, of unlimited length.
Try This

Copy and screenshot your


work into meeting chat
Float

Float, or "floating point number" is a number, positive


or negative, containing one or more decimals.
Try This

Copy and screenshot your


work into meeting chat
Float can also be scientific
numbers with an "e" to
indicate the power of 10.

Example:
2.3e5 = 2.3 * 105
= 2.3 * 100000
= 230000
Try This

Copy and screenshot your


work into meeting chat
Complex

Complex numbers are written with a "j" as the


imaginary part
to verify the type of any object in
Python, use the type() function:
Try This

Copy and screenshot your


work into meeting chat
Activity: Fill in the blanks

____________
____________
____________
Questions
What’s the difference
between a and b?
number

string
Type Conversion

You can convert from one type to another


with the int(), float(), and complex() methods
Try This
Can you solve this?
Convert Convert
string to int to
int string

OR
Question and
Answer

You might also like