πŸ”₯ LIVE πŸ‘©β€πŸ« Teachers: Host Live Tests  |  πŸŽ“ Students: Practice Class-wise Quizzes Go to Quiz Portal βž”

Number Data Type in python

Number Data Type in python

Python Numbers

Number data types store numeric values. Number objects are created when you assign a value to them.

For example βˆ’

var1 = var2 = 10

You can also delete the reference to a number object by using the del statement. The syntax of the del statement is βˆ’

del var1[,var2[,var3[….,varN]]]]

You can delete a single object or multiple objects by using the del statement. For example βˆ’

del vardel var_a, var_b

Python supports four different numerical types βˆ’

  • int (signed integers)
  • long (long integers, they can also be represented in octal and hexadecimal)
  • float (floating point real values)
  • complex (complex numbers)

Examples

Here are some examples of numbers βˆ’

IntLongfloatComplex
1051924361L0.03.14j
100-0x19323L15.2045.j
-7860122L-21.99.322e-36j
0800xDEFABCECBDAECBFBAEl32.3+e18.876j
-0490535633629843L-90.-.6545+0J
-0x260-052318172735L-32.54e1003e+26J
0x69-4721885298529L70.2-E124.53e-7j
  • Python allows you to use a lowercase l with long, but it is recommended that you use only an uppercase L to avoid confusion with the number 1. Python displays long integers with an uppercase L.
  • A complex number consists of an ordered pair of real floating-point numbers denoted by x + yj, where x and y are the real numbers and j is the imaginary unit.
Jitendra Singh
βœ” Verified Educator

Jitendra Singh

Founder of CBSEPython.in

I help CBSE Class 9–12 students learn Python, Information Technology, Artificial Intelligence and Computer Science through easy notes, quizzes, MCQs and sample papers.

Read More About Me β†’

Leave a Comment