Censur Analyzer in Python

Your assignment is to create a Python Census analyzer tool that will allow the user to analyze individuals, households, and incomes. The tool will first greet the user and explain that it is a Census analyzer tool. It will then ask the user how many households are in the area of interest. For each household, the program will ask the user how many individuals live in the household, and it will ask the user for each individual's income. After all data entry is completed, the tool will report the income distribution as well as four summary statistics: the number of people in the area; the number of people per household; the average individual income; and the average household income. Finally, the tool will allow the user to run this analysis for as many areas as desired.

 

When the tool asks the user the initial question of how many households are in the area, you may assume that the user will respond with an integer number (that is, no decimal households). In addition, you may also assume that the user enters an integer number of individuals in each household.

 

After all data entry is completed, the tool should report the number of people in the area, the number of people per household, the average individual income, and the average household income. Finally, the tool should also report on the income distribution in the area. The tool should report the number of households with income less than $20,000, the number of households with at least $20,000 but less than $40,000 in income, the number of households with at least $40,000 but less than $60,000 in income, the number of households with at least

$60,000 but less than $80,000 in income, and the number of households with at least $80,000

in income.

 

At the end of the program, prompt the user for whether they would like to analyze another

area. Allow the user to continue analyzing as many areas as desired.

 

Some considerations as you write your program:

 

When your program asks the user for a response, consider the possibility that the user will respond in uppercase, lowercase, or mixed case letters (''YES", "yes", or "Yes", for example). Ensure that your program can handle any of these possibilities appropriately.

 

You may assume that the user indicates each numeric value with valid formatting.

 

Ensure that your prompts and output are crisp, professional, and well-formatted. For example, ensure that you have used spaces appropriately and double-checked your spelling.

 

• Adding comments in your code is encouraged. You may decide how best to comment your code. At minimum, please use a comment at the start of your code to describe its basic functionality.

 

Please use the following example as a template for the tool's expected functionality:

 

Welcome to the Census analyzer!

 

How many households would you like to analyze? 3

How many people live in household 1? 2

What was person l ’s income last year? 10000 What was person 2 * s income last year? 34000 How many people live in household 2? 3

What was person l's income last year? 0 What was person 2 ’s income last year? 40000 What was person 3's income last year? 22000 How many people live in household 3? 1

What was person l ’s income last year? 18000

Number of people: 6

People per household: 2.0

Average individual income: 20666.67

Average household income: 41333.33

 

Income distribution:

Less than $20,000: 1 household(s)

At least $20,000 but less than $40,000: 0 household(s) At least $40,000 but less than $60,000: 1 household(s) At least $60,000 but less than $80,000: 1 household(s) At least $80,000: 0 household(s)

Would you like to analyze another area ( yes/no)? yes

How many households would you like to analyze? 2

How many people live in household 1? 2

What was person l's income last year? 20000 What was person 2 ’s income last year? 30000 How many people live in household 2? 1

What was person l's income last year? 100000

Number of people: 3

People per household: 1.5

Average individual income: 50000.0

Average household income: 75000.0

 

Income distribution:

Less than $20,000: 0 household(s >

At least $20,000 but less than $40,000: 0 household(s)

At least $40,000 but less than $60,000: 1 household(s) At least $60,000 but less than $80,000: 0 household(s) At least $80,000: 1 household(s)

Would you like to analyze another area (yes/ no)? no

Thank you for using the Census Analyzer!

Need a custom answer at your budget?

This assignment has been answered 2 times in private sessions.

© 2024 Codify Tutor. All rights reserved