Description
Before starting to code any of the problems, write pseudocode and/or draw flowcharts. Do not start coding until you have a deeper understanding of the solutions should look like. Write pseudocode from which you can directly code your program.
1. Convert a Height to Meters
Convert a height entered by the user as feet and inches to meters. The name of the Python code file will be FirstnameLastname_S_01_01.py, where S = your section number.Here are the steps:
1.1 Prompt the user for thehours and get the value from the user.
1.2 If the user presses just the
1.3 Do the same for the inches. Again, the user pressing just the
1.4 Calculate the total inches from the feet and inches. If the total inches is greater than or equal96 inches (the equivalent of 8’0 or more), print a message that the person is really tall!
1.5 Convert inches to centimeters. There are exactly 2.54 centimeters per inch.
1.6 Convert the centimeters to meters and centimeters, rounding to two places.
1.7 Print the original height and the equivalent in meters with messages describing each number. Format your numbers to two decimal places.
1.8 Exit the program.
2. Convert from miles per gallon to liters per kilometer. The name of the Python code file will be FirstnameLastname_S_01_02.py.
2.1 Prompt the user to enter a figure for miles per gallon.
2.2 If the amount is <= 0, exit the program.
2.3 Convert miles to kilometers and gallons to liters. (Google the formulas.)
2.4 From the previous step, calculate liters per kilometer.
2.5 Print the miles per gallon and liters per kilometer with relevant messages, formatting your results to one decimal place.
2.6 Exit the program.
3. Print the color of a square on a chessboard.The name of the Python code file will be FirstnameLastname_S_01_03.py, where S = your section number. A chessboard square is identified by
3.1 Print a multi-line message explaining what the program does and the format of the input.
3.2 Prompt the user to enter two characters, the first one a letter, the second one a digit. Examples of input are given above.
3.3 Ensure the first character is in the range of a-h and the second one is in the range of 1-8. If not print an error message and exit the program.
3.4 From the letter and digit combination determine the color of the square and print the result to the user with a message like “Square e4 is white” or “Square d6 is black.”
3.5 Test your program with invalid squares like j5 or a9.
3.6 Exit the program.
Hint: first determine the column, then determine the row.
This problem is from The Python Workbook, by Ben Stephenson, page 20, exercise 45.
What and how to submit
You should have three Python files now:
FirstnameLastname_S_01_01.py
FirstnameLastname_S_01_02.py
FirstnameLastname_S_01_03.py
where S = your section number. Print your programs and staple them together in order. Write this information at the upper right of the first page: name, section and project #.
How your programs are evaluated
1. Do they work according to the specifications?
2. Are the input prompts correct?
3. Are the programs documented?
4. Do the programs follow Python and file naming standards?