Two short-answer questions and the python source code in text or screenshots of all programs.
4. (20 points) Use ”if-elif-else” to write a program that prompts the user to input a numeric value and displays the effect of an earthquake, as measures by the Richter scale
|
Richter Scale |
|
|
Value |
Effect |
|
8 or greater |
Most structures fall |
|
7 to 7.99 |
Many buildings destroyed |
|
6 to 6.99 |
Many buildings considerably damaged, some collapse |
|
4.5 to 5.99 |
Damage to poorly constructed buildings |
|
Less than 4.5 |
No destruction of buildings |
· (5 points) Draw a flowchart to understand the program selection flow
· (10 points) Write your program here, or copy/paste a screenshot of your Program:
· (2 points) Screenshot of a Program Run:
· (3 points) Save the program as “earthquake.py”. Upload the .py file as part of your submission.
5. (20 points) Write a program that reads an input temperature value, then reads an input letter (C for Celsius or F for Fahrenheit). Print whether the state of matter is liquid, solid, or gaseous at the given temperature at sea level. Let:
C = (F -32)*5/9
Solid: C<=0
Gaseous: C>=100
Liquid: 0<C<100
· (5 points) Draw a flowchart to understand the program selection flow
· (10 points) Write the program here, or copy/paste the screenshot of your program
· (2 points) Screenshot of a Program Run:
(3 points) Save the program as “state.py”. Upload the .py file as part of your sub