Reference no: EM132484704
Programming Task
Aims
Develop a Python program to solve a problem
Follow good program development and coding style practices
Use loops and/or selection statements
Instructions
Write a Python program to solve the following problem. Your solution should include a readme.md file (which includes details of how to run your assignment) and your Python program in a file named air_quality.py, and be submitted as a single .tgz file named a2.tgz.
If each of the files in your solution are in the current working directory, you can create the .tgz file with the following command (see man tar for more details):
tar -zc readme.md air_quality.py > a2.tgz
To test your archive contains the correct files, copy it to an empty directory, change to that directory and run:
tar -zxf a2.tgz
This should result in readme.md and air_quality.py being extracted to the directory.
You should ensure your solution works using the Python 3 interpreter on turing.
Problem
Codetown has been having air quality issues. Some people have been having health issues, and some outdoor events have had to be cancelled, because breathing has been difficult.
In order to understand the extent of the problem, data are required. The mayor of Codetown has contacted you to develop a program for use by council workers in various parts of the city to collect air quality information, which will be used to help make informed decisions for future changes in the town.
Your program is to first request the number of air quality measurements that will be entered in the interaction with the program, and must then loop this number of times to collect the amount of ozone (parts per hundred million), sulfur dioxide (parts per hundred million), and particles less than 2.5 micrometers diameter (micrograms per cubic metre) that were measured for that site. Your program should then output the air quality index (AQI) for that measurement (using the calculation below).
The AQI is calculated as the maximum AQI for each of the pollutants being measured (ozone, sulfur dioxide, and particles less than 2.5 micrimeters diameter). The air quality index for each pollutant can be calculated as AQI_pollutant = 100*(pollutant data reading)/standard, where pollutant data reading is the value entered by the user for that pollutant and the standard value for each pollutant is given in the following table.
Pollutant |
Standard value |
Ozone |
8.0 parts per hundred million |
Sulfur dioxide |
20 parts per hundred million |
Particles less than 2.5 micrometre diameter |
25 micrograms per cubic metre |
Your program should ensure that the number of readings being entered is a positive integer, and that all values for ozone, sulfur dioxide, and particles less than 2.5 micrometre diameter are non-negative numbers. If this is not the case, your program should prompt the user to enter the information that was entered incorrectly again.
Note that program specifications are not always clear. If you are uncertain about any aspect, you are typically better off asking than making assumptions. Please use the appropriate discussion forum to ask for clarification, if required.
Attachment:- Programming Task.rar