In python
1. Write a semi-smart unit converter Conversion of various quantities between unit systems is a very common engineering task. The Python pepject for this term is to write a simple script that will do unit conversion for the user. Name the script that does this unitConversion. py. Domains The converter will work to convert units within specific domains. The domains should include: . time length mass e capacity e temperature force e pressure . angles .energy/moment e power It is suggested, for the initial approach, that students figure out how to do one domain. Then expand to two or three of the domains listed. After those stages are working, add the others Within each domain, there should be at least four different units supported. In addition, pick any four domains and support six types of units for that domain. The exception is angles, which need only support two units: degrees and radians. Where applicable, roughly half of the units for a domain should be metric units (m, N, liters, etc.) and the other half should be U.S. Customary units (e.g. ft, lbi, gallons, etc.). Angles and time need not meet this requirement. Googling "common units for x" where x is a domain will yield handy units for each domain, similarly, web searches will give conversion factors to high accuracy User Input The script should ask the user for a value and its units. The script will determine from those units which domain is involved and then present the user with a list of values in all of the units in that domain. . The user will enter the number and then a space and then the units, all on one line * The script should recognize common short abbreviations for units. E-g w . watts, pounds force, etc. It is okay to make the user match the internal unit string exactly. If the units are not recognized, the script should print out a message and continue. Input units that are multiplied are separated by a space. All units following a/sign are in the denominator. For example: in lbf/sec inch pounds force/second. By comparing the part of the string after the space, the script should determine the domain. The user does not have to enter the domain explicitly Output The script output should have the following features The output values should have 5 digits to the right of the decimal point The output should not repeat the user's input units . The output format should print in a neat format, with the output values decimal points aligned . The user will be iven the option to do another after each unit conversion is complete. If the . The user should have an option to type H for help and see a short example of what could be for each output quantity. See the example output below for guidance user enters anything other than 'Q' or q, the script should continue. entered as well as a summary of the domains and units that are recognized. The help should be human-readable and should not have unneeded brackets, braces, etc. from list or dictionary data that has not been formatted Calculations Conversion factors should have at least 6 significant figures Note that most units can be converted using a single factor in unit, -const unit, fashion. Eg. 1 meter 39.3701 inches. But, some, like temperature, follow a unit consti x unit + const, pattern and will require two constants. A clever programmer can use the same system for both types, by alliowing const to be O for the domains that don't need it. The project script is to be written using no sclentific or mathematical modules that the student has not written independently. The project scope is well within the programming ability of ME 021 students Hint on setting up the math: Rather than work out all of the combinations of unit conversions within a domain (which will be quite a few for domains with 6 units, it may be useful to pick one unit as the standard" for each doman (it won't matter which one is chosen) and then determine how to go from any unit to that standard unit and then go from that standard unit to the others Code Flexibility The code should be written so that adding new units to domains and adding new domains requires changing only a few lines of code without adding whole new variables. For instance, adding a new domain should not require a new variable to be declared, just that a previously defined list or dictionary be expanded. Similarly, the help output that tells the users what units and domains are available should be generated automatically from the data lines. This can easily be accomplished by using dictionaries to hold the domains and unit strings Spring 2019 Python Project 1. Write a semi-smart unit converter Conversion of various quantities between unit systems is a very common engineering task. The Python project for this term is to write a simple script that will do unit conversion for the user. Name the script that does this UnitConversion . py Domains The converter will work to convert units within specific domains. The domains should include etime . length emass e capacity e temperature e force e pressure eangles e energy/moment * power It is suggested, for the initial approach, that students figure out how to do one domain. Then expand to two or three of the domains listed. After those stages are working, add the others. Within each domain, there should be at least four different units supported. In addition, pick any four domains and support six types of units for that domain. The exception is angles, which need only support two units: degrees and radians. Where applicable, roughly half of the units for a domain should be metric units (m, N, liters, etc.) and the other half should be U.S. Customary units (e.g. ft, lbi, gallons, etc.). Angles and time need not meet this requirement. Googling "common units forx" where x is a domain will yield handy units for each domain. Similarly web searches will give conversion factors to high accuracy. User Input The script should ask the user for a value and its units. The script will determine from those units which domain is involved and then present the user with a list of values in all of the units in that domain. . The user will enter the number and then a space and then the units, all on one line The script should recognize common short abbreviations for units. E.g. W Watts, lbf- pounds force, etc. It is okay to make the user match the internal unit string exactly If the units are not recognized, the script should print out a message and continue Input units that are multiplied are separated by a space. All units following a / sign are in the denominator. For example: in 1bf/sec inch*pounds force/second. .By comparing the part of the string after the space, the script should determine the domain. The user does not have to enter the domain explicitly Output The script output should have the following features: The output values should have 5 digits to the right of the decimal point. . The output format should print in a neat format, with the output values' decimal points aligned The user will be given the option to do another after each unit conversion is complete. If the . The user should have an option to type H for help and see a short example of what could be The output should not repeat the user's input units. for each output quantity. See the example output below for guidance user enters anything other than 'Q' or q, the script should continue. entered as weas a summary of the domains and units that are recognized. The help should be human-readable and should not have unneeded brackets, braces, etc. from list or dictionary data that has not been formatted Calculations Conversion factors should have at least 6 significant figures. Note that most units can be converted using a single factor in unit const x unit fashion. Eg. 1 meter 39.3701 inches. But, some, like temperature, follow a unit const xunit const pattern and will require two constants. A clever programmer can use the same system for both types, by allowing const to be 0 for the domains that don't need it. The project script is to be written using no scientific or mathematical modules that the student has not written independently. The project scope is well within the programming ability of ME 021 students. Hint on setting up the math: Rather than work out all of the combinations of unit conversions within a domain (which will be quite a few for domains with 6 units), it may be useful to pick one unit as the "standard" for each domain (it won't matter which one is chosen) and then determine how to go from any unit to that standard unit and then go from that standard unit to the others. Code Flexibility The code should be written so that adding new units to domains and adding new domains requires changing only a few lines of code without adding whole new variables. For instance, adding a new domain should not require a new variable to be declared, just that a previously defined list or dictionary be expanded. Similarly, the help output that tells the users what units and domains are available should be generated automatically from the data lines. This can easily be accomplished by using dictionaries to hold the domains and unit strings. Examples The following is an example run. Note that it tests the help and quit features and prints the help message when unrecognized units are used. The results are in a tidy format with numbers in a straight umn. C:\Users \brokow UCM Classes ME 82112019 Spring Assignments>UnitConverter.py 848 >> Unit Converter: At any prompt, enter H for help, Q to quit.