Skip to content

Instantly share code, notes, and snippets.

View Shruti-Mishra77's full-sized avatar
💭
Learning

Shruti-Mishra77

💭
Learning
View GitHub Profile
@Mohamed2del
Mohamed2del / 3.1.py
Created June 9, 2018 15:06
Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above 40 hours. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should use input to read a string and float()…
hrs = input("Enter Hours:")
h = float(hrs)
xx = input("Enter the Rate:")
x = float(xx)
if h <= 40:
print( h * x)
elif h > 40:
print(40* x + (h-40)*1.5*x)
@KKarthikeya
KKarthikeya / 4.6.py
Created August 16, 2015 04:19
Write a program to prompt the user for hours and rate per hour using raw_input to compute gross pay. Award time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of time-and-a-half in a function called computepay() and use the function to do the computation. The function should return a valu…
def computepay(hours,rate):
if hours>40.0:
p = rate * 40.0
p = p+(1.5*rate*(hours-40))
else:
p = rate*hours
return p
hours = float(raw_input("Enter worked hours: "))
rate = float(raw_input("Enter Pay rate per hour: "))
print computepay(hours,rate)