Skip to content

Instantly share code, notes, and snippets.

@AndreVallestero
Created December 5, 2022 01:12
Show Gist options
  • Save AndreVallestero/6d78cef5274862d06775ede9a9a659ad to your computer and use it in GitHub Desktop.
Save AndreVallestero/6d78cef5274862d06775ede9a9a659ad to your computer and use it in GitHub Desktop.
calculate floor space from realtor.ca listings
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