Check if the seller has made profit or not in Python
if else - Question 3
In this question, we will see how to input cost price and sale price and check if the seller has made a profit or not in Python programming using the if else statement. To know more about if else statement click on the if else statement lesson.
Q3) Write a program in Python to input cost price and sale price and check if seller has made profit or not.
Program
cp=int(input('Enter cost price '))
sp=int(input('Enter sale price '))
if sp>cp:
print('The seller has made a profit')
else:
print('The seller has not made any profit')
Output
Enter cost price 350 Enter sale price 465 The seller has made a profit