Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python 1. Create a program that reads a pressure from the user in kilopascals. Once the pressure has been read your program should report

image text in transcribed

Using Python

1. Create a program that reads a pressure from the user in kilopascals. Once the pressure has been read your program should report the equivalent pressure in pounds per square inch, millimeters of mercury and atmospheres. Use your research skills to determine the conversion factors between these units. 2. The following table contains earthquake magnitude ranges on the Richter scale and their descriptors: Magnitude Less than 2.0 2.0 to less than 3.0 3.0 to less than 4.0 4.0 to less than 5.0 5.0 to less than 6.0 6.0 to less than 7.0 7.0 to less than 8.0 8.0 to less than 10.0 10.0 or more Descriptor Micro Very Minor Minor Light Moderate Strong Major Great Meteoric Write a program that reads a magnitude from the user and displays the appropriate descriptor as part of a meaningful message. For example, if the user enters 5.5 then your program should indicate that a magnitude 5.5 earthquake is considered to be a moderate earthquake. 3. The following Python program finds the smallest non-trivial (not 1) prime factor of a positive integer. n = int(input("Input an integer > 1: ")) i = 2 while (n % i) != 0: i += 1 print("The smallest factor of {0:d} is {1:d}" format (n, i)) (a) Type this program into your computer and verify that it works as advertised. Then briefly explain how it works and why the while loop always terminates. (b) Modify the program so that it tells you if the integer input is a prime number or not. If it is not a prime number, write your program so that it prints out the smallest prime factor. Using your program verify that the following integers are prime numbers: 101,8191,94811,947431

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

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago