93.5k views
3 votes
his exercise creates a program to convert the temperature values form Fahrenheit to Celsius for a list of 10 temperature values between -10° and 75°. The program shall have the following features:1. Create a temperature list that contains 10 values ranging from -10° to 75°.2. Create a function to convert temperature values from Fahrenheit to Celsius.3. Create a while-loop to index the temperature value item in the list and call the function to calculate the temperature value in Celsius.4. Print the temperatures in the format of:32 degrees Fahrenheit = 0 degrees Celsius

User Nugi
by
7.0k points

1 Answer

7 votes

Answer:

def fahrenheit_to_celsius(temperature):

c = (temperature - 32) / 1.8

return c

temperature_list = [-10, -5, 0, 10, 20, 32, 40, 50, 60, 75.2]

i = 0

while i < 10:

print(str(temperature_list[i]) + " degrees Fahrenheit = " + str(fahrenheit_to_celsius(temperature_list[i])) + " degrees Celsius")

i += 1

Step-by-step explanation:

*The code is in Python.

Create a function named fahrenheit_to_celsius that takes one parameter, temperature

Convert the temperature to celsius using the formula

Return the result of the conversion

Create a list holding ten temperatures

Create a while loop that iterates 10 times. Inside the loop, call the function to convert the each temperature in the list and print the result

User Kirsty
by
6.4k points