#!/usr/bin/python3
# generator.py by Bill Weinman [http://bw.org/]
# This is an exercise file from Python 3 Essential Training on lynda.com
# Copyright 2010 The BearHeart Group, LLC
# decimal places.py
# This program demonstrates how a value can be
# formatted, rounded to different numbers of
# decimal places.
my_value = 1.123456789
print ('%.lf' % my_value) # Rounded to 1 decimal place
print ('%.2f' % my_value) # Rounded to 2 decimal places
print ('%.3f' % my_value) # Rounded to 3 decimal places
print ('%.4f' % my_value) # Rounded to 4 decimal places
print ('%.5f' % my_value) # Rounded to 5 decimal places
print ('%.6f' % my_value) # Rounded to 6 decimal places
valuel = 6.7891234
value2 = 1.2345678
print ('The values are %.1f and %.3f ' % (valuel, value2))
my_value = 1.123456789
print ('The value is : %6.2f ' % my_value)