About Lesson
if
Statement
The if
statement checks a condition and, if it evaluates to True
, it executes the block of code associated with it.
Python
#decision control
mrp=float(input("enter mrp of book"))
dis=0
if mrp>=500:
dis=mrp*10/100
else:
dis=mrp*5/100
net=mrp-dis
print(f"MRP={mrp}, dis={dis}, Net Price={net}")
#print("MRP={0}, DIS={1}, Net={2}".format(mrp,dis,net))
#print("MRP=%.2f, DIS=%.2f, Net=%.2f"%(mrp,dis,net))
'''
1. enter 2 nos and print biggest number
2. enter sale price and cost price print proft or loss
... 3 programs search from google
'''