Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Integer Numbers
course content

Conteúdo do Curso

Data Types in Python

Integer NumbersInteger Numbers

You might be accustomed to specifying numbers in ways such as:
1,000,000 (with commas) or
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.

Tarefa

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.

Tudo estava claro?

Seção 1. Capítulo 3
toggle bottom row
some-alt