Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to validate all years entered for every option, values should be within 1950 and 1990. Display error message if input is not correct

I need to validate all years entered for every option, values should be within 1950 and 1990. Display error message if input is not correct

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

Description You will create Python code that does the following. Open and read in the data in the file USPopulation.txt (available on classes.pace.edu). The file contains the midyear population of the United States, in thousands, during the years 1950 through 1990. The first line of the file is the population for 1950 , the second line for 1951 , and so forth. Use the following CoLab template as the starting point for your code: link to colab page Write code that reads the file's contents into a list. You will need to carry out the following steps on the data (each line) from the file: - remove end of line character - change input value from string to an integer - convert to original number by multiplying by 1000 REQUIRED (Basic version) - you must use the coding template for your solution - validate all years entered for every option, values should be within 1950 and 1990. Display error message if input is not correct - option 1 - ask user to input a year, then display the population formatted with commas - option 2 - ask user to input two years, then calculate difference in population formatted with commas - exit OPTIONAL (Advanced version) - all components of basic version must be complete and functional - option 3 - ask user to input two years, then display the average population formatted with commas and two decimal places for that range. For example, if the years 1984, and 1987 are entered, you will display the average population of 1984,1985,1986, and 1987. (Include both endpoints of the range). SUPER ADVANCED VERSION - all components of basic AND advanced version must be complete and functional - option 4 - ask user to input two years, and display line graph of population data - option 5 - ask users to input two years, then display a bar graph of population data \# user choice choice = input("Select an option: ") \# type in the appropriate numbers for the choices if choice==str( 1 ) : option1 (poplist) elif choice==str(2): option2 (poplist) elif choice==str(3): option3(poplist) elif choice==str(4): option4 (poplist) elif choice==str(5): option5 (poplist) else: print("Program is exiting") tocontinue = False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxxviii Special Issue On Database And Expert Systems Applications Lncs 11250

Authors: Abdelkader Hameurlain ,Roland Wagner ,Sven Hartmann ,Hui Ma

1st Edition

3662583836, 978-3662583838

More Books

Students also viewed these Databases questions

Question

Define procedural justice. How does that relate to unions?

Answered: 1 week ago