Plutonic Rainbows

Salary Calculator

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"
	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.