Monday, 21 January 2019

Here is 2nd Challenge for Python Practice 
Question 2:-
3 product enter than you show what is billning product and what is free product
2K < == 5%
2k - 5k == 10%
5K- Above == 20%
discount first calculate than count tax
total * 5/100
toatal * 10/100
total * 20/100

Solutions ==> 

a = int(input("Enter First Product Price : "))
b = int(input("Enter Second Product Price : "))
c = int(input("Enter Third Product Price : "))
def buy_get_one_free(p1,p2,p3):
free = 0
if b > a < c:
free += a
elif a > b < c:
free += b
else:
free += c
return free

print(f"Free Product is {buy_get_one_free(a,b,c)}")
total = a+b+c-(buy_get_one_free(a,b,c))
print(f"Total product Value : {total}")

def tax(t):
tax = 0
if total < 2000:
tax += 0
elif 4000 < total > 2000:
disc = (total * 5)/100
tax += disc
elif 4000 < total > 6000:
disc = (total * 10)/100
tax += disc
elif total > 6000:
disc = (total*20)/100
tax += disc
return tax

print(f"Your Discount Value is {tax(total)}")
print(f"Your Total Paid Amount is {total-tax(total)}")



Output ==> 
Enter First Product Price : 50000
Enter Second Product Price : 60000
Enter Third Product Price : 70000
Free Product is 50000
Total product  Value : 130000
Your Discount Value is 6500.0
Your Total Paid Amount is 123500.0

No comments:

Post a Comment