SHOW:
|
|
- or go back to the newest paste.
1 | #!C:\Python32 | |
2 | #Filename: py4infoex2.3.py | |
3 | ||
4 | - | hours = float (input ('hours worked?\n')) |
4 | + | from decimal import * |
5 | - | rate = float (input ('hourly wage?\n')) |
5 | + | getcontext() |
6 | ||
7 | - | pay = round ((hours * rate), 2) |
7 | + | hours = Decimal (input ('hours worked?\n')) |
8 | - | print ('wages earned: ${0}'.format(pay)) |
8 | + | rate = Decimal (input ('hourly wage?\n')) |
9 | ||
10 | pay = Decimal ((hours * rate).quantize (Decimal ('.01'), rounding=ROUND_UP)) | |
11 | print ('wages earned: ${0}'.format(pay)) | |
12 | ||
13 |