Created
November 9, 2013 13:57
-
-
Save chasinglogic/7385681 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
def string_analyzer(string): | |
first_num = "" | |
second_num = "" | |
x = False | |
print(string) | |
for letter in string: | |
if x == False: | |
if letter == "x" or letter == "X": | |
x = True | |
else: | |
first_num = first_num + letter | |
else: | |
second_num += letter | |
print(first_num) | |
print(second_num) | |
conv_f_num = int(first_num) | |
conv_s_num = int(second_num) | |
return conv_f_num, conv_s_num | |
def calculate_cost(area, width, length, cost): | |
area_of_tile = length * width | |
return (area / area_of_tile) * cost | |
def calculate_labor(area): | |
working_area = float(area) / 20.00 | |
return working_area * 86.00 | |
width = raw_input("What's the width of a unit of flooring? ") | |
length = raw_input("What's the length of a unit of flooring? ") | |
cost = raw_input("How much does a unit of flooring cost? ") | |
size = raw_input("How big is the room? (give size in format Num x Num: ") | |
l, w = string_analyzer(size) | |
area = l * w | |
material_cost = calculate_cost(area, int(width), int(length), int(cost)) | |
print("The cost of materials is %d, The cost of labor would be %f. Total cost is %f." % (material_cost, calculate_labor(area), material_cost + calculate_labor(area))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment