temp=-12
#Result
print -temp
#To compute weekly pay
#Get input
#yearly=input("What is your annual pay?")
yearly=38000.00
weekly=yearly/52
#Result
print "\nYour weekly pay is ",float(weekly)
#Compute the average of three grades
grade1=87.5
grade2=92.4
grade3=79.6
#Average calculation
avg=grade1+grade2+grade3/3.0
#Result
print "The average is: ",avg
#Declaration
bonus=50
salary=1400.50
#Calculation
total=salary+bonus
#Result
print "The total is ","%.2f" %total
#Calculate interest
days=45
principle=3500.00
interest_rate=0.155
#daily interest rate
daily_interest=interest_rate/365
daily_interest=principle*daily_interest*days
#Update principle
principle+=daily_interest
#Result
print "The balance you owe is:","%.2f" %principle
#Calculate salesperson's pay based on his or her sales
print "Payroll Calculation\n"
print "------------------------\n"
#Get input
sal_name=raw_input("What is salesperson's last name? ")
hours=input("How many hours did the salesperson work? ")
total_sales=input("What were the total sales? ")
bonus=0
#Compute base pay
pay=4.10*float(hours)
if total_sales>8500.00:
bonus=500.00
#Result
print sal_name,"made $","%.2f" %pay, "\n and got a bonus of $","%.2f" %bonus
#Get input
age=input("What is the student's age?")
if age<10:
print "\n*** The age cannot be less than 10 ***\n"
print "Try again...\n"
age=input("What is the student's age?")
#Result
print "\nThank you. You entered a valid age."
##Print square of the input value if it is lessthan 180
#Get input
num=input("What number do you want to see the square of?")
if num<=180:
square=num*num
print "The square of ",num,"is ",square,"\n"
print "\nThank you for requesting square roots.\n"
num=input("What number do you want to see the square of?")
if num>180:
import os
os.system('\a')
print "\n* Square is not allowed for numbers over 180 *"
print "\nRun this program again trying a smaller value."
print "\nThank you for requesting square roots.\n"
#Get input
#num=input("What is your answer?\n")
num=1
if num>0:
print "\nMore than 0\n"
else:
print "\nLess or equal to 0\n"
print "\nThanks for your time."
#Test user's first initial and prints a message.
#Get input
#last=raw_input("\nWhat is your last name?\n")
last="Praveen"
#test the initial
if last[0] <= 'P':
print "Your name is early in the alphabet.\n"
else:
print "You have to wait a while for Your name to be called\n"
#Get input
#hours=input("\nHow many hours were worked?")
#rate=input("\nWhat is the regular hourly pay?")
hours=44
rate=0.20
#Compute pay
if hours>50:
dt=2.0*rate*float(hours-50)
ht=1.5*rate*10.0
else:
dt=0.0
#Time and a half
if hours>40:
ht=1.5*rate*float(hours-40)
#Regular pay
if hours>=40:
rp=40*rate
else:
rp=float(hours)*rate
#Payroll
pay=dt+ht+rp
#Result
print "\nThe pay is ","%.2f" %pay
#if...else...if
#yrs=input("\nHow many years of service?")
yrs=25
if yrs>20:
print "\nGive a gold watch"
else:
if yrs>10:
print "\nGive a paper weight"
else:
print "\nGive a pat on the back"
#To determine if it is Summer Olympics year
#year=input("\nWhat is a year for the test?")
year=2004
#Test the Year
if year%4==0 and year%10==0:
print "\nBoth Olympics and U.S. Census!"
exit(0)
if year%4==0:
print "\nSummer Olympics only"
else:
if year%10==0:
print "\nU.S. Census only"
#Get input
#age=input("\nWhat is your age?\n")
age=20
if age<10 or age>100:
print "*** The age must be between 10 and 100 ***\n"
else:
print "You entered a valid age."
# -*- coding: cp1252 -*-
#Program that computes video rental amounts and gives
# appropriate discounts based on the day or customer status.
print "\n *** Video Rental Computation ***\n"
print "--------------------------------------\n"
tape_charge=2.00 #Before-discount tape fee-per tape.
first_name=raw_input("\nWhat is customer's first name? ")
last_name=raw_input("\nWhat is customer's last name? ")
num_tapes=input("\nHow many tapes are being rented? ")
val_day=raw_input("Is this a Value day (Y/N)?")
sp_stat=raw_input("Is this a Special Status customer (Y/N)?")
# Calculate rental amount.
discount=0.0
if val_day=='Y' or sp_stat=='Y':
discount=0.5
x=num_tapes*tape_charge
y=discount*num_tapes
rental_amt=x-y
print "\n** Rental club **\n"
print first_name,last_name,"rented ",num_tapes," tapes "
print "The total was ","%.2f" %rental_amt
print "The discount was ","%.2f" %discount,"per tape\n"
if sp_stat=='Y':
print "\nThank them for being a special Status customer\n"