Created
June 12, 2018 02:41
-
-
Save maxking/eb989d20e79fa473bd193b0baf93745b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a=[] | |
revenue_min_max = [] | |
# b=[] | |
revenue_likely = [] | |
# x = [] | |
cost_min_max = [] | |
# y=[] | |
cost_likely = [] | |
# output array. | |
result = [] | |
# The the amount of data we are expecting. | |
revenue_nos=int(input("enter revenue no. of fields")) | |
cost_nos=int(input("enter cost no. of fields")) | |
# range of revenue is of the form (min_revenue, max_revenue) and revenue_min_max | |
# is a list of (min, max) | |
print("ENTER Min and Max VALUES FOR REVENUE") | |
for i in range(0, revenue_nos): | |
revenue_min_max.append((int(input()), int(input()))) | |
# range of cost is of the form (min_cost, max_cost) and cost_min_max is a list | |
# of (min, max) | |
print("ENTER Min and Max VALUES FOR COST") | |
for i in range(0, cost_nos): | |
cost_min_max.append((int(input()), int(input()))) | |
# revenue like is a list of likely revenue values. | |
print("ENTER Most Likely VALUES FOR REVENUE") | |
for i in range(0, revenue_nos): | |
revenue_likely.append(int(input())) | |
# cost_likely is a list of likely cost values. | |
print("ENTER Most Likely VALUES FOR COST") | |
for i in range(0, cost_nos): | |
cost_likely.append(int(input())) | |
# sum of cost_likely array. | |
cost_likely_sum = sum(cost_likely) | |
# sum of revenue_likely array. | |
revenue_likely_sum = sum(revenue_likely) | |
for a, b in zip(revenue_min_max, revenue_likely): | |
# a is (min, max), b is likely | |
output = (a[0] - b + revenue_likely_sum - cost_likely_sum, | |
a[1] - b + revenue_likely_sum - cost_likely_sum) | |
result.append(output) | |
for a, b in zip(cost_min_max, cost_likely): | |
# a is (min, max), b is likely. | |
output = (revenue_likely_sum - (a[0] - b + cost_likely), | |
revenue_likely_sum - (a[1] - b + cost_likely)) | |
result.append(output) | |
# Print output. | |
for each in result: | |
print(each) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment