We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ca122a commit a7ec984Copy full SHA for a7ec984
1 file changed
Week6_Assignment_4_6.py
@@ -0,0 +1,28 @@
1
+'''Write a program to prompt the user for hours and rate per hour input to compute gross pay.
2
+Pay should be the normal rate upto 40 hours and time-and-a-half for the hourly rate for all hours worked above 40 hours
3
+Use function.'''
4
+
5
+#definr function computepay that will calculate the gross pay
6
+def computepay(h,r):
7
+ if h>40:
8
+ pay = (40*r)+((h-40.0)*r*1.5)
9
+ else:
10
+ pay = h*r
11
12
+ return pay
13
14
+#take inputs
15
+hrs = input('Enter hours: ')
16
+rate = input('Enter hourly pay: ')
17
18
+#chck if the inputs are correct
19
+try:
20
+ vhrs = float(hrs)
21
+ vrate = float(rate)
22
+except:
23
+ print('Hour and Rate must be numeric values.')
24
+ quit()
25
26
+#return gross pay
27
+gross = computepay(vhrs,vrate)
28
+print(gross)
0 commit comments