write a program that produce a bar chart showing the population growth of Prairieville, a small town in the Midwest, at 20 year intervals during the past 100 years. the program should read in the population figures (rounded to the nearest 1000 people) for 1900, 1920, 1940, 1960, 1980, and 2000 form a file. for each year it should dosplay the date and a bar constucting of one asterisk for each 1000 people. the data can be found in the people.dat.file

example:

paririeville population growth
(each * represents 1000 people)

1900 **
1920 ****
1940 *****

What's your question?

To create a program that produces a bar chart displaying the population growth of Prairieville at 20-year intervals, you can follow these steps:

1. First, open the "people.dat" file to read the population figures. Make sure the file is located in the same directory as your program. You can use the `open()` function to open and read the file.

2. Read the population figures for 1900, 1920, 1940, 1960, 1980, and 2000 from the file. These figures are rounded to the nearest 1000 people.

3. Calculate the number of asterisks to be displayed for each year based on the population figures. Dividing the population figure by 1000 will give you the number of asterisks to display.

4. Construct a string of asterisks based on the calculated number for each year. You can use a loop to repeat the asterisk character the required number of times.

5. Display the year and the bar chart constructed using the asterisks. You can use the `print()` function to output the data.

Here's an example Python program that implements the steps mentioned above:

```python
# Step 1: Open and read the file
with open('people.dat', 'r') as file:
population_data = file.readlines()

# Step 2: Read the population figures for each year
population_figures = [int(population_data[i].strip()) for i in range(6)]

# Step 3 and 4: Construct the bar chart for each year
for i, population in enumerate(population_figures):
year = 1900 + (i * 20)
bar_chart = '*' * (population // 1000)

# Step 5: Display the year and bar chart
print(f'{year} {bar_chart}')
```

Make sure the "people.dat" file contains the population figures in the expected format and is saved in the same directory as your program. The program will read each figure, calculate the appropriate number of asterisks, and display the year and bar chart accordingly.