..
Applying Knowledge - Class 2
Write a Python program that receives the cost (value in Real) of a theatrical show and the price per ticket (value in Real) for this show. This program must calculate and display:
Requirements:
- a) The minimum number of tickets that must be sold to at least cover the cost of the show.
- b) The number of tickets that must be sold to achieve a profit of 23 percent.
Note: The numbers of tickets to be calculated should be integers. Therefore, the results for the number of tickets must be rounded up, using an appropriate math function in Python.
Input:
- The cost (value in Real) of a theatrical show and the price per ticket (value in Brazilian Reais) for the show.
Output:
- The number of tickets that must be sold to at least cover the cost of the show.
- The number of tickets that must be sold to achieve a profit of 23 percent.
Sample Inputs/Outputs:
foo@bar:~$ py baz.py
10000
10
1000
1230
foo@bar:~$
SOLUTION:
import math
x = float(input())
y = float(input())
print(math.ceil(x/y), math.ceil(x*1.23/y), sep='\n')
for fun:
import math; (lambda x, y: print(math.ceil(x/y), math.ceil(x*1.23/y), sep='\n'))(float(input()), float(input()))