Configuration

Night mode

Integers

Learn Python Essentials for Data Science Course

Engineers From These Top Companies and Universities Trust EXLskills

1M+ Professionals | 100+ Institutions

This is the EXLskills free and open-source Python Introduction Course. It guides learners via explanation, demonstration, and thorough practice, from no more than a basic understanding of Python, to a moderate level of essential coding proficiency.

Is this course FREE?

Yes, this a 100% free course that you can contribute to on GitHub here!

Have more questions?

Variables

Integers

Our first variable: Integers

In python an integer refers to a number that is does not have any decimal places. Unlike other coding languages to initialize an integer, you just set a variable equal to a number that does not have a decimal.

In the editor below, we will go ahead and assign x equal to a number (36) and then print out the variable. Pressing run will allow you to see the output & you can try it yourself in the ipython terminal!

The input is in script.py, while the output will be in the ipython terminal. If this is difficult, please message an instructor!

#Declare the Variable (x can be equal to any integer)
x = 36
#Print out x with some text
print('x is equal to: ',x)

Official Definition:

These are often called just integers or ints, are positive or negative whole numbers with no decimal point.

You can add integers together which will result in another integer. Below is an example of how you would do this. By running the code below you will see the output of adding these two variables together!