XXXXXXXXXXC CIT-115/115L Python XXXXXXXXXXProfessor Brian Candido XXXXXXXXXXSTCC3
Lists and Real Estate Analyze
The owner of BDJ Real Estate of Springfield has hired you to design a sales analyzer program for real estate sales. You can enter the property sales by entering a valid sales dollar amount repeatedly until the user says No to more input. You don’t know up front of how many entries you will have so a List must be used.
Once the data entry is complete you write code to find out the different analytics for the sales: Min, Max, Average, Median, Total and Commission.
1. Code a function Code a function called getFloatInput that receives a string as a parameter to be used as the prompt input text and it returns a float. You will be calling this function for each value to be inputted and assign the function’s return value and assign to each of the listed variables. For example:
fSalesPrice = getFloatInput(“Enter property sales value:”)
Perform data validation within the function on the inputted value using Python e
or handling which can be found in Blackboard. Use Python’s loops to accomplish the sub-tasks below:
· If the contents are not numeric issue a message and prompt them again until the user enters a valid number for each of the input variables.
· Make sure the inputted value are non-zero and positive values or issue an e
or message and ask for input again.
· Return a valid non-zero float.
2. Code a function called getMedian that receives a list and returns a float that does the following (you must write your own code you can NOT use the median function in the Python statistics module):
· If the number of entries in the list is odd, divide the count by 2 and use that entry as the median
· If the number of entries in the list is even divide the count by 2. Take that that entry and the entry before it and average the two elements and use that as the median.
· Return the calculated median value.
3. Code a main function that includes these requirements:
· Use a list to store all the user inputted sales values.
· Code a loop that repeats until the user enters a N to exit the loop:
· Each time through the loop call the getFloatInput function to prompt the user for the sales price.
· Each value returned from the function getFloatInput must be added to the list
· Prompt the user with “Enter another value Y or N”. If the user enters a Y or y repeat the user input loop. If the user enters a N or n exit the loop. If any other value is entered keep asking until a Y, y, N or n is entered.
· Sort the list from smallest value to largest.
· Refer to the sample output below to help you code and visualize the required output and make sure it matches the screen shot below before submitting your code.
· Output each entry in the sorted list to the screen that is formatted as cu
ency with 2 decimal positions
· Determine the Minimum value and output formatted as cu
ency with 2 decimal positions to the screen.
· Determine the Maximum value and output formatted as cu
ency with 2 decimal positions to the screen.
· Determine the Total value and output formatted as cu
ency with 2 decimal positions to the screen.
· Calculate the Average and output cu
ency with 2 decimal positions to the screen.
· Determine the Median by calling the getMedian function you coded in Step 2 by passing list of values that was populated in the loop. Receive the Median value returned from the getMedian function and output formatted value as cu
ency with 2 decimal positions.
· Determine the Commission by multiplying the Total of the calculation by .03 and output the formatted value as cu
ency with 2 decimal positions.
4. Make sure to include comments in your code.
Sample Output
With 4 entries:
With 3 entries:
With e
ors:
Grading Ru
ic
Criteria
Meets
(100%)
Somewhat
(50%)
Not Present
(0%)
Input Conversions and
Data Validations placed in the getFloatlInput function.
5 points
Input Function fully coded.
Data validation was fully implemented and functional.
Input Function somewhat coded.
Data validation was attempted but not fully functional.
Input Function not present.
Data validation not implemented.
Coded the getMedian function as detailed in the instructions 30 points
The getMedian Function is present and coded co
ectly.
The getMedian Function was attempted but with some e
ors or inco
ect results or not coded in the most efficient manner in terms of execution.
The getMedian function is not present and/or the median logic was all placed in the main() function.
Loop, List Coding and Appending Function 20 points
Loop, List and Appending were done properly with the co
ect results using Python list functions.
Loop, List and Appending were attempted but with some e
ors or inco
ect results. Or Python list functions not properly used.
Loop, List and Appending were not attempted.
Summary Functions
40 points
Summary Functions are all present and coded co
ectly.
Summary Functions were attempted but with some e
ors or inco
ect results or not coded in the most efficient manner in terms of execution.
Summary Functions not attempted.
Comments,
Formatting
and
Variable Prefixing 5 points
Comments present and variable prefixing.
Output was co
ectly formatted per the sample.
Either Comments present or variable prefixing.
Output was attempted but did not match the sample.
No Comments present and No variable prefixing.
No formatting was attempted.