{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Numbers and more in Python!\n", "\n", "In this lecture, we will learn about numbers in Python and how to use them.\n", "\n", "We'll learn about the following topics:\n", "\n", " 1.) Types of Numbers in Python\n", " 2.) Basic Arithmetic\n", " 3.) Differences between classic division and floor division\n", " 4.) Object Assignment in Python" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Types of numbers\n", "\n", "Python has various \"types\" of numbers (numeric literals). We'll mainly focus on integers and floating point numbers.\n", "\n", "Integers are just whole numbers, positive or negative. For example: 2 and -2 are examples of integers.\n", "\n", "Floating point numbers in Python are notable because they have a decimal point in them, or use an exponential (e) to define the number. For example 2.0 and -2.1 are examples of floating point numbers. 4E2 (4 times 10 to the power of 2) is also an example of a floating point number in Python.\n", "\n", "Throughout this course we will be mainly working with integers or simple float number types.\n", "\n", "Here is a table of the two main types we will spend most of our time working with some examples:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
Examples | \n", "Number \"Type\" | \n", "
---|---|
1,2,-5,1000 | \n", "Integers | \n", "
1.2,-0.5,2e2,3E2 | \n", "Floating-point numbers | \n", "