Guest User

Lønn

a guest
Mar 23rd, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. def user_input():
  2.     '''Take input from user,return a tuple'''
  3.     while True:
  4.         try:
  5.             houer_pay = float(raw_input('How much is the houerly payment'))
  6.             work_houers = float(raw_input('How many houers did she work'))
  7.             tax = float(raw_input('How many % did she pay in taxes'))
  8.             return houer_pay, work_houers, tax
  9.         except ValueError:
  10.             print 'Only numbers as input,try again'
  11.  
  12. def calculate(user_input):
  13.     '''Caculate gross salary'''
  14.     houer_pay, work_houers, tax = user_input
  15.     return houer_pay * work_houers * (1-(tax/100))
  16.  
  17. if __name__ == '__main__':
  18.     print calculate(user_input())
  19.     help(calculate) #When we use docstring in function help works
Advertisement
Add Comment
Please, Sign In to add comment