🙋 Need help? Ask an expert now!

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, 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!

# Define the variable x x = 3 # Define the variable y y = 6 # Make z equal to the sum of x and y z = x+y # Print out some text and the value of variable z print('The sum of the variables is: ',z)

This will give you a new variable z which is equal to 9

Edit Me on GitHub!