Salary Calculator
February 27, 2019
This script uses quite a few new things including a function. It calculates two user input values and then gives an answer depending on the outcome. The user is asked for the number of weeks and the payment each week.
# -*- encoding: utf-8 -*-
def salary(weeks, payments):
return (weeks * payments)
weeks = (float(raw_input("Weeks: ")))
payments = (float(raw_input("Payments: ")))
total = salary(weeks, payments)
print "\nThe total is {0:.2f}".format (total)
if total < 7999 or total == 7999:
print "That's not good enough.\n"
else:
print "You are on target.\n"
The script also uses float and format for currencies and values that use decimal places. Don't forget to declare -*- encoding: utf-8 -*- at the beginning of the script.
Recent Entries
- Filter First, Think Later February 21, 2026
- Five Hundred Bugs That Fuzzers Missed February 20, 2026
- Gemini 3.1 Pro and the 0.1 That Matters February 19, 2026