Print 1 pen cost price in Python
print() - Question 14
In this question, we will see how to print the cost of one pen if the cost of 12 pens is Rs. 150 in python programming using the print() function. To know more about print() function click on the print() function lesson.
Q14) Write a program in python to print the cost of one pen if the cost of 12 pens is Rs. 150.
Program
print('Cost of 12 pens = Rs.150')
print('Cost of 1 pen = Rs.{:.2f}'.format(150/12))
Output
Cost of 12 pens = Rs.150 Cost of 1 pen = Rs.12.50