Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Integer Numbers | Getting Familiar With Numbers in Python
Data Types in Python

Integer NumbersInteger Numbers

You might be accustomed to specifying numbers in ways such as:

  • 1,000,000 (with commas);
  • 1 000 000 (with spaces).

However, Python will not understand this.😢

These formats are understandable for a person but not for a computer, so the right way is 1000000 without commas or spaces.

Task

Here is the distance from the sun to the Earth in miles: var1 = 91,400,000. And here is the distance from the Earth to the moon: var2 = 238 855. You need to adjust these number formats to be compatible with Python.

  • Rewrite the values of these two distances so they are recognizable by Python;
  • Output these variables by including their names in print function calls.

Note

If you have a strong desire to use separators, Python understands the following syntax: var = 1_000_000.

Everything was clear?

Section 1. Chapter 3
toggle bottom row
course content

Course Content

Data Types in Python

Integer NumbersInteger Numbers

You might be accustomed to specifying numbers in ways such as:

  • 1,000,000 (with commas);
  • 1 000 000 (with spaces).

However, Python will not understand this.😢

These formats are understandable for a person but not for a computer, so the right way is 1000000 without commas or spaces.

Task

Here is the distance from the sun to the Earth in miles: var1 = 91,400,000. And here is the distance from the Earth to the moon: var2 = 238 855. You need to adjust these number formats to be compatible with Python.

  • Rewrite the values of these two distances so they are recognizable by Python;
  • Output these variables by including their names in print function calls.

Note

If you have a strong desire to use separators, Python understands the following syntax: var = 1_000_000.

Everything was clear?

Section 1. Chapter 3
toggle bottom row
some-alt