Posts

Showing posts from July, 2022

Python Data Types - Int

  # Lone Star Development Training - Int Data Types # INTEGERS (INTS) # Ints are one of the most common data types that you will see in Python. # They are numbers without decimals and can be positive, negative, or zero. # Python also supports numbers with decimals, but they are classified as a different # data type and will be covered later. # Examples my_int1 = 0 my_int2 = 55 my_int3 = -10 # Print each of the int examples above print(my_int1) print(my_int2) print(my_int3) # Now that we have introduced two data types, if you have a variable, and you're not sure what # the type of the variable is, you can use the print() function combined with the type() function # as shown in the example below. variable1 = '25' variable2 = 25 # When we print the type of variable1, we will get a statement that declares it a string. # These are the variable types that you worked with over the last two sessions. print(type(variable2)) # Now, print the type of variable2, and see how it dif...