bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!

Python Numbers

 

The data which is stored in memory are of different types. In python there are five types of data types are used –

  • Numbers
  • String
  • List
  • Tuple
  • Dictionary

data type

 

  • Integers

These are the whole numbers and the range of integers are depend on the hardware on which python is run. Integers are of different types like positive, negative, zero, and long.

e.g

I = 123   // Positive Integer

J = -20 // Negative Integer

K = 0     // Zero Integer

 

  • Long Integers

Long integer is used to store the large numbers without losing precision. To write long integers L suffix is used.

e.g.

I = 99999999999L

 

  • Octal and Hexadecimal

It also includes octal and hexadecimal number. To represent the octal which have base 8 in python add a preceding zero. So the interpreter recognized that you wanted the value to be in base eight and not in base ten.

e.g.

I = 11 Then in Octal you will write –

>>I = 011

>>print I

Then it will give the output 9

To represent the hexadecimal number which have base 16 in python add a preceding 0x. So the interpreter recognized that you wanted the value to be in base sixteen and not in base ten.

>>> I = 0x11

>>> print I

Then it will give the output 17

 

  • Floating Point numbers

They symbolize the real numbers that are written with a decimal point dividing the integer and fractional parts. It includes the decimal value which is not included in integers. Floating point numbers may also be in scientific notation with E or e indicating the power of 10 like 5.5e4 i.e. 5.5 * 10^2

e.g.

I = 2.5

J = 7.5E4 etc.

 

  • Complex Numbers

Complex numbers are of the form of a + bj where a is realpart floating value and b is the imaginary part floating value and j represents the square root of -1.

e.g.

2.5 + 24

This blog will help you get a better understanding of Automate Your Coding with Python!

"0 Responses on Python Numbers"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

top

Sales Offer

  • To avail this offer, enroll before 09th December 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free Python Numbers.