Salary Calculator 2
March 4, 2019
Here is a slightly modified script for the Salary Calculator. This time we are writing the result to a text file. Some folks over on the Python forum helped me with target.write(str(round(total, 2)).encode()) as I could not figure a way to round the decimal place correctly.
# -*- encoding: utf-8 -*-
from sys import argv
script, answer = argv
def salary(weeks, payments):
return (weeks * payments)
weeks = (float(raw_input("Weeks: ")))
payments = (float(raw_input("Payments: ")))
total = salary(weeks, payments)
target = open(answer, 'w')
target.truncate()
target.write(str(round(total, 2)).encode())
target.close()
This post is timestamped using Blockchain technology. Verify
Recent Entries
- Twelve Hundred Guests and a Bad Headline July 25, 2026
- Escada Kept Drawing Carriages July 25, 2026
- Selling Leather With His Own Face July 25, 2026