Python provides a print function that displays the value of a variable. For example,
>>> freq = 22.0/7.0 >>> x = 7.234 >>> print 'Vibration frequency = ', freq Vibration frequency = 3.14285714286 >>> print 'Vibration frequency = ', freq, 'Displacement =\ ... ', x Vibration frequency = 3.14285714286 Displacement = 7.234
>>> print 'Vibration frequency = %s Displacement =\ ... %s' % (freq, x) Vibration frequency = 3.14285714286 Displacement = 7.234
>>> print 'Vibration frequency = %6.2f Displacement =\ ... %6.2f' % (freq, x) Vibration frequency = 3.14 Displacement = 7.23
>>> print 'Vibration frequency = %.6E Displacement =\ ... %.2E' % (freq, x) Vibration frequency = 3.142857E+00 Displacement = 7.23E+00
The + flag indicates that a number should include a sign.
The \n escape sequence inserts a new line.
The \t escape sequence inserts a tab character.
For example,
>>> print 'Vibration frequency = %+.6E\nDisplacement =\ ... %+.2E' % (freq, x) Vibration frequency = +3.142857E+00 Displacement = +7.23E+00