mikeckennedy / python-jumpstart-course-demos

Contains all the "handout" materials for my Python Jumpstart by Building 10 Apps course. This includes try it yourself and finished versions of the 10 apps.
https://talkpython.fm/course
MIT License
746 stars 536 forks source link

non matching output 09_real_estate_analyzer for 2-bedroom home #7

Closed bbelderbos closed 7 years ago

bbelderbos commented 7 years ago

Hi Michael,

Nice exercises, thanks.

Running program.py in 09 I get:

Average 2-bedroom home is $56,615, baths=1, sq ft=824.3

The try screenshot shows a higher amount, and the baths feature instead of sq ft:

https://github.com/mikeckennedy/python-jumpstart-course-demos/tree/master/apps/09_real_estate_analyzer/you_try

One thing I spotted in the code is that you take the first 6 items for homes before printing the 2-bedroom bit:

homes = []
for h in two_bed_homes:
    if len(homes) > 5:  # why the break?
        break
    homes.append(h)

When I take the break out, I get the right numbers:

Average 2-bedroom home is $165,428, baths=1.4, sq ft=957.2

Cheers Bob

mikeckennedy commented 7 years ago

Thank you @bbelderbos I wonder why I did this first 5 only? I'll have to go back and have a look.

mikeckennedy commented 7 years ago

Hi Bob! I went through this example again and watched the video. The "you try" section does have a different answer than the final code demo.

But the goal in the "you try" section wasn't to match the final output. It was to start with the CSV file and generate the output in the picture in that you try section.

I see why this is confusing but I also want the final code to match what's in the video as closely as possible. So I'm not sure there is an improvement to be made.

I added this to the bottom of the steps in you try:

Note: To see finished code that outputs the expected numbers, you can use this alternate branch: App 9's program.py for this "you try" section

bbelderbos commented 7 years ago

Yeah trivial thing, no worries. Thanks for checking and above all for your awesome work. Have a great day.