. Create a list of temperatures in degrees Celsius with the values 25.2,16.8, 31.4, 23.9, 28, 22.5, and 19.6, and assign it to a variable called temps. Using one of the list methods, sort temps in ascending order. Write for loop to convert all the values from temps_in_celsius into Fahrenheit, and store the converted values in a new list temps_in_fahrenheit. - Pratik Ghelani

Pratik Ghelani

Breaking

Sunday, May 10, 2020

. Create a list of temperatures in degrees Celsius with the values 25.2,16.8, 31.4, 23.9, 28, 22.5, and 19.6, and assign it to a variable called temps. Using one of the list methods, sort temps in ascending order. Write for loop to convert all the values from temps_in_celsius into Fahrenheit, and store the converted values in a new list temps_in_fahrenheit.

Input:-

n = int(input("Enter the temperature list:"))
Temp = [25.2,16.8, 31.4, 23.9, 28, 22.5,19.6]
b = []


for i in range (0,n):
   
    Temp.append(b)

for i in range (0,n):
    temp1 = (Temp[i]*9/5)+32
    b.append(temp1)

for i in range (0,n):

    print(str(Temp[i]) + " celsius to fahrenheit : "+ str(b[i]))

Output:-


No comments:

Post a Comment