
Exploring Numbers: Integers and Floating-Point Numbers
Welcome back, aspiring Pythonista! In our last step, we printed our very first message to the screen. Now, let's dive into the fascinating world of numbers in Python. Computers are excellent at crunching numbers, and Python provides us with two primary ways to represent them: integers and floating-point numbers.
Integers, often shortened to 'int', are whole numbers, both positive and negative, without any decimal point. Think of them as counting numbers. Examples include 0, 1, -5, 42, and -1000. Python can handle integers of virtually any size, limited only by your computer's memory!
my_age = 30
number_of_students = 150
negative_score = -10We can also perform standard arithmetic operations with integers:
sum_result = 5 + 3
difference = 10 - 4
product = 6 * 7
quotient = 20 / 4
exponent = 2 ** 3Note that division with integers in Python 3 (which is what we're using) will always result in a floating-point number, even if the result is a whole number. We'll explore this more in the next section.