Numeric (int/float) Variables in Python

Well, this is pretty straight-forward. We have used number variables twice in this tutorial.

If you ask many people how many girlfriends they have, they will give you a number. Some have 12, some have 4, and some have 1. People like me have 0. All are numbers.

When the value of a variable is a number, it is called a numeric variable. Numbers don’t need any quotation marks because the computer identifies them instantly.

Gf = 15
print (Gf)

That code will print 15.

Now, there are different types of numbers. If math has taught you anything, you should remember that we have decimals, fractions, etc. In Python, too, these different types of numbers are represented well. They are defined as int, float, and complex classes in Python.

Int and floats are real numbers, but one has a decimal point, and the other does not. The number 5 is an integer, while 5.0 is a float.

Conversely, a complex number is an algebraic number. Something like 5 yj.

Do you want to become an expert programmer? See books helping our students, interns, and beginners in software companies today (Click here)!

Leave a Comment

Python Tutorials