-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetProfit_Python.py
More file actions
72 lines (50 loc) · 1.65 KB
/
NetProfit_Python.py
File metadata and controls
72 lines (50 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 20 10:31:30 2018
@author: adityanalge
"""
def allocate_half(x):
return int(x//2)
def num_teams():
while True:
teams = input("Enter Number of Teams :\n")
try:
teams = int(teams)
return teams
break
except ValueError:
print("\nThat's not a valid Input! Try Again")
def num_tickets():
while True:
tickets = input("Enter Number of Tickets Available for Sale\n")
try:
tickets = int(tickets)
return tickets
break
except ValueError:
print("\nThat's not a Valid Input! Try Again")
def ticket_cost():
while True:
ticket_cost = input("Enter Cost of Each Ticket\n")
try:
ticket_cost = int(ticket_cost)
return ticket_cost
break
except ValueError:
print("\nThat's not a valid Input! Try Again")
def old_profit(a,b):
return a * b * 0.1
def new_profit(a,b,c):
return a* b * c * 0.1
if __name__ == "__main__":
total_teams = num_teams()
total_tickets = num_tickets()
ticket_cost = ticket_cost()
teams_upper = allocate_half(total_teams)
teams_lower = allocate_half(total_teams)
tickets_upper = allocate_half(total_tickets)
tickets_lower = total_tickets - tickets_upper
old_profit = old_profit(total_tickets,ticket_cost)
new_profit = new_profit(tickets_upper,ticket_cost,allocate_half(total_teams)) + new_profit(tickets_lower,ticket_cost,allocate_half(total_teams))
print(old_profit)
print(new_profit)