Introduction to Computer Programming: Lab 0

Goals

Instructions

  1. Python basics in the IDLE shell. Try these examples in order, one at a time:

    >>> 33 + 47
    
    >>> x
    >>> x = 5
    >>> x
    
    >>> y = x + 1
    >>> y
    >>> x = x * 2
    >>> x
    >>> y
    >>> (x + 1) * (y - 1)
    
    >>> 15 / 3
    >>> 15 / 2
    >>> 15 // 2
    >>> 17 / 5
    >>> 17 // 5
    >>> 17 % 5
  2. Open the file simple_functions.py in IDLE. Read the examples. Use “Run module” to load the file into the shell. Try each function in the shell as in:

    >>> three_one(25)

To work on the remaining problems: