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
course content

Course Content

Data Types in Python

Data Types in Python

1. Getting Familiar With Numbers in Python
2. True or False?
3. Strings
4. Bring All the Topics Together

bookInteger 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
test

Swipe to show code editor

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 3
toggle bottom row

bookInteger 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
test

Swipe to show code editor

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 3
toggle bottom row

bookInteger 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
test

Swipe to show code editor

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

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
test

Swipe to show code editor

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 3
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt