code_Part2_spaudel_lab_4

py

School

Cornell University *

*We aren’t endorsed by this school

Course

156

Subject

Aerospace Engineering

Date

Oct 30, 2023

Type

py

Pages

1

Uploaded by AmbassadorZebraPerson424

Report
# Function to get a valid starting Celsius temperature def get_valid_celsius_temperature(): while True: try: celsius_temperature = float(input("Enter in the starting temperature: ")) if celsius_temperature >= -273.15: return celsius_temperature else: print("Error: Temperature cannot be below absolute zero. Please reenter.") except ValueError: print("Error: Please enter a valid number for Celsius temperature.") # Get the valid starting Celsius temperature start_celsius = get_valid_celsius_temperature() # Initialize lists to store temperature values celsius_values = [] fahrenheit_values = [] kelvin_values = [] # Calculate and store values using a for loop for i in range(21): current_celsius = start_celsius + i celsius_values.append(current_celsius) fahrenheit = (9/5) * current_celsius + 32 fahrenheit_values.append(fahrenheit) kelvin = current_celsius + 273.15 kelvin_values.append(kelvin) # Display the table using both loops print("\nTemperature conversions using a while loop") print("{:<15} {:<15} {:<15}".format(" Cels", " Fahr", " Kelvin")) for i in range(21): print("{:<15.2f} {:<15.2f} {:<15.2f}".format(celsius_values[i], fahrenheit_values[i], kelvin_values[i])) print("\nTemperature conversions using a for loop") print("{:<15} {:<15} {:<15}".format(" Cels", " Fahr", " Kelvin")) for i in range(21): print("{:<15.2f} {:<15.2f} {:<15.2f}".format(celsius_values[i], fahrenheit_values[i], kelvin_values[i])) # Display a goodbye message print("Thank you for using the program")
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: A movie theater estimates that the price elasticity of demand for evening movie tickets is 1.22.  If…
Q: The following figure shows the total cost and total revenue for a firm when it prices its products…
Q: Got Flu Shot Did not get Flu Shot Category Got Flu Shot Did not get Flu Shot The expected…
Q: Use a graphing calculator to graph the equation in the standard window. y = 4x + 5 ㄴ CHE Choose the…
Q: (8.71× 0.0301) 0.056
Q: Question 10 Solve csc(5x) - 3 = 0 for the four smallest positive solutions Give your answers…
Q: A wildlife biologist is interested in comparing the mean number of miles flown per day by two types…
Q: An investor has $826,000 to invest in bonds. Bond A yields an average of 5% and the bond B yields…
Q: 7. An old "trick" for cooling down a hot beverage quickly is to immerse a cold spoon into the…
Q: The production cost for g graphing calculators is C(g) = 15g. Graph the function and then evaluate…
Q: How many symmetry planes and symmetry axis in C3H8O. also is there a center of symmetry in C3H8O?
Q: 13) A box is pulled along a smooth floor by a force F, making an angle with the Horizontal. As o…
Q: 10. Use the results from 8 & 9 to show the uncertainty principle holds for a particle in a 1-D box.…
Q: X > y 4 6 4 -1 A. -0.885 OB. -0.995 O C. -0.778 OD. -0.671 13 - 13 10 -8 8 -4 7 -3 Pounding to three…
Q: If CH3OONa is addddd to a solutiom of CH3COOH, i’d the pH of the acid going to increase or decrease
Q: Name four protective functions of the skin
Q: A rock is thrown off a vertical cliff at an angle of 65 degrees above horizontal. The cliff is 67.2…
Q: What is the value of x after the following code executes? double m = 2.67; int x = (int)m;
Q: Use the 2016 marginal tax rates to compute the tax owed by the following person.   A single man with…
Q: To find the distance across a small lake, a surveyor has taken the measurements shown. Find the…
Q: In the reaction: Which element is oxidized? 2 K₂S2O3 + I2 → K₂S4O6 + 2 KI Which element is reduced?…
Q: Find a3, a4, and as of the sequences. a. a₁ = 1, a2=2, an=2an 1+3 an 2 b. an an = (n + 1) + (n + 2)…