Skip to content

Commit bf1aee0

Browse files
committed
PEP 8 formatting.
1 parent 852fd2a commit bf1aee0

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

apps/09_real_estate_analyzer/final/program.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import csv
22
import os
3+
34
try:
45
import statistics
56
except:
@@ -31,7 +32,7 @@ def get_data_file():
3132

3233
def load_file(filename):
3334
with open(filename, 'r', encoding='utf-8') as fin:
34-
# with open(filename, 'r') as fin:
35+
# with open(filename, 'r') as fin:
3536
reader = csv.DictReader(fin)
3637
purchases = []
3738
for row in reader:
@@ -59,8 +60,8 @@ def load_file(filename):
5960
# def get_price(p):
6061
# return p.price
6162

62-
def query_data(data): # list[Purchase]):
63-
63+
def query_data(data): # list[Purchase]):
64+
6465
# data.sort(key=get_price)
6566
data.sort(key=lambda p: p.price)
6667

@@ -95,7 +96,7 @@ def query_data(data): # list[Purchase]):
9596
two_bed_homes = (
9697
p # projection or items
9798
for p in data # the set to process
98-
if announce(p, '2-bedrooms, found {}'.format(p.beds)) and p.beds == 2 # test / condition
99+
if announce(p, '2-bedrooms, found {}'.format(p.beds)) and p.beds == 2 # test / condition
99100
)
100101

101102
homes = []
@@ -108,7 +109,7 @@ def query_data(data): # list[Purchase]):
108109
ave_baths = statistics.mean((p.baths for p in homes))
109110
ave_sqft = statistics.mean((p.sq__ft for p in homes))
110111
print("Average 2-bedroom home is ${:,}, baths={}, sq ft={:,}"
111-
.format(int(ave_price),round(ave_baths, 1), round(ave_sqft, 1)))
112+
.format(int(ave_price), round(ave_baths, 1), round(ave_sqft, 1)))
112113

113114

114115
def announce(item, msg):
@@ -118,9 +119,3 @@ def announce(item, msg):
118119

119120
if __name__ == '__main__':
120121
main()
121-
122-
123-
124-
125-
126-

0 commit comments

Comments
 (0)