write a python code for this:-
A company pays the salary to its customers on hourly work basis as per the following criteria.
First 8 hours Rs. 20 per hour
Next 4 hours Rs. 30 per hour
First 6 hours Rs. 50 per hour
For more than 18 hours Rs. 100 per hour
Write the code to input number of hours worked in a day by a worker. Calculate and print his monthly
salary considering that he works for same no. of hours daily
Answers
You can do it with an IF statement.
name = input ("enter your name")
n = float(input("how many hours did you work for?")
#provided minimum hour of work is 8 hrs
if (n in range (0,8)) :
print ("your salary for today is" n * 20)
elif (n in range (8,12)):
print ("your salary for today is" n *30)
elif (n in range (12, 18)):
print ("your salary is" n *50)
elif (n > 18) :
print (" your salary is" n *100)
monthly salary can be calculated by storing the salary in another variable and multiplying by 30 or 31 provided that the weekends are also working days.
Answer:
choice = "Yes"
while choice == "Yes":
print("1. Breakfast", "2. Lunch", "3. Dinner", sep = "\n")
c = input("State the choice of your order: ")
print()
if c == "1":
a = int(input("Enter your amount of order: "))
if a > 500:
print("You receive a discount of 15%.")
ta = a - (a*0.15)
print(ta, "is your payable amount.")
else:
print("You receive a discount of 5%.")
ta = a - (a*0.05)
print(ta, "is your payable amount.")
elif c == "2":
a = int(input("Enter your amount of order: "))
if a > 500:
print("You receive a discount of 15%.")
ta = a - (a*0.15)
print(ta, "is your payable amount.")
else:
print("You receive a discount of 5%.")
ta = a - (a*0.05)
print(ta, "is your payable amount.")
elif c == "3":
a = int(input("Enter your amount of order: "))
if a > 500:
print("You receive a discount of 15%.")
ta = a - (a*0.15)
print(ta, "is your payable amount.")
else:
print("You receive a discount of 5%.")
ta = a - (a*0.05)
print(ta, "is your payable amount.")
print()
choice = input("Next payment? [Yes/No]: ")
print()