''' formattedstrings.py Jeff Ondich, 2013-01-05 Updated for Python 3, 2019-01-04 Demonstrates formatted strings (surprise!). Intended as the Python half of parallel examples in Python and Java. See FormattedStrings.java. ''' n = 701 x = 3.0 / 7.0 animal = 'gerenuk' announcement1 = 'The animal: {0}'.format(animal) announcement2 = 'The integer: {0:d} (decimal), {1:X} (hexadecimal)'.format(n, n) announcement3 = 'The real number with 2, then 3 digits past the decimal point: {0:.2f}, {1:.3f}'.format(x, x) print(announcement1) print(announcement2) print(announcement3)