Next: String Literals Up: Recent Additions Previous: Recent Additions

The Last Printed Expression

In interactive mode, the last printed expression is assigned to the variable _This means that when you are using Python as a desk calculator, it is somewhat easier to continue calculations, for example:


        >>> tax = 17.5 / 100
        >>> price = 3.50
        >>> price * tax
        0.6125
        >>> price + _
        4.1125
        >>> round(_, 2)
        4.11
        >>>


guido@cwi.nl