Introduction
The print function
Variables
Math in Python
The input function
Summary
20. Summary

Instruction

Great! It's time to wrap things up.

  1. print(x) shows x in the console output.
  2. print(x, y, ...) will show x, y, and any number of additional arguments, all separated with single spaces.
  3. To assign the value 3 to a variable named number, use:

    number = 3
  4. Among others, there are three basic data types:

    • integer (int),
    • float (float) – floating point numbers with a dot (.),
    • string (string) – text values in apostrophes.
  5. Mathematical operators:

    • +, -, *, / – addition, subtraction, multiplication, division.
    • // – floor division (i.e. round down to nearest integer).
    • %a%b finds the remainder from the division of a by b.
    • To accept user input, use:

      amount = input('What is the amount?')
    • To convert between data types, use str(x), int(x) and float(x).

Alright, how about a challenge now?

Exercise

Click the Next exercise to begin the quiz.