Created
December 5, 2022 01:12
-
-
Save AndreVallestero/6d78cef5274862d06775ede9a9a659ad to your computer and use it in GitHub Desktop.
calculate floor space from realtor.ca listings
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
lines = [] | |
user_input = "a" | |
print("Input realtor.ca room dimensions in meters (put empty line when done): ") | |
while (len(user_input.strip()) > 0): | |
user_input = input() | |
lines.append(user_input) | |
total = 0 | |
for line in lines: | |
if len(line) < 1 or not line[0].isnumeric(): continue | |
[x, y] = [float(dim.replace('m', '').strip()) for dim in line.split('x')] | |
total += x * y | |
print(f'Total space: {round(total)} m^2\nOr: {round(total*10.7639)} ft^2') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment