Question

In: Computer Science

Using Python, use the following list (Temperature = [56.2,31.8,81.7,45.6,71.3,62.9,59.0,92.5,95.0,19.2,15.0]) to: - Create a loop to iterate...

Using Python, use the following list (Temperature = [56.2,31.8,81.7,45.6,71.3,62.9,59.0,92.5,95.0,19.2,15.0]) to:

- Create a loop to iterate through each of the elements in the temperature list.

- Convert each element of this list to a Celsius temperature and then, for each valid temperature in the list, print out both the original Fahrenheit temperature and the Celsius equivalent in this format: "32 degrees Fahrenheit is equivalent with 0 degrees Celsius."

Solutions

Expert Solution

NOTE:

Be clear with indentation error while copying the code it may casuse indentaion error.

solution:

program 1: Create a loop to iterate through each of the elements in the temperature list.

code:

Temperature=[56.2,31.8,81.7,45.6,71.3,62.9,59.0,92.5,95.0,19.2,15.0]
print("creating loop to iterate over the list")
for i in Temperature:
print(i)

OUTPUT:

creating loop to iterate over the list
56.2
31.8
81.7
45.6
71.3
62.9
59.0
92.5
95.0
19.2
15.0


scrrenshot:

program 2: each element of this list to a Celsius temperature and then,
for each valid temperature in the list,
print out both the original Fahrenheit temperature and the Celsius equivalent in this format:
"32 degrees Fahrenheit is equivalent with 0 degrees Celsius."

code:

Temperature=[56.2,31.8,81.7,45.6,71.3,62.9,59.0,92.5,95.0,19.2,15.0]
for i in Temperature:
c=(i-32)/1.8
print(i," degrees Fahrenheit is equivalent with ",c," degrees Celsius")

OUTPUT:

56.2 degrees Fahrenheit is equivalent with 13.444444444444446 degrees Celsius
31.8 degrees Fahrenheit is equivalent with -0.11111111111111072 degrees Celsius
81.7 degrees Fahrenheit is equivalent with 27.61111111111111 degrees Celsius
45.6 degrees Fahrenheit is equivalent with 7.555555555555556 degrees Celsius
71.3 degrees Fahrenheit is equivalent with 21.833333333333332 degrees Celsius
62.9 degrees Fahrenheit is equivalent with 17.166666666666664 degrees Celsius
59.0 degrees Fahrenheit is equivalent with 15.0 degrees Celsius
92.5 degrees Fahrenheit is equivalent with 33.61111111111111 degrees Celsius
95.0 degrees Fahrenheit is equivalent with 35.0 degrees Celsius
19.2 degrees Fahrenheit is equivalent with -7.111111111111112 degrees Celsius
15.0 degrees Fahrenheit is equivalent with -9.444444444444445 degrees Celsius


scrrenshot:


Related Solutions

Create Python Code using a "for" loop and a "while" loop. You are starting a twelve...
Create Python Code using a "for" loop and a "while" loop. You are starting a twelve week program training to compete in a triathlon. The triathlon consists of three athletic events, 1.5 k swim, 40k bike, 10k run. In order to be prepared for the competition you want to print a training schedule. Starting with week 1 you will increase the distance of each activity so that you reach the race distance by week twelve. Due to rounding, you may...
PYTHON 1. Write a for loop to iterate across a user entered string in reverse order...
PYTHON 1. Write a for loop to iterate across a user entered string in reverse order Use an input statement to ask the user for a string using the prompt: Cheer? [space after the ?] and assign to a variable Start the for loop to iterate across the elements in the string in reverse order Display each element of the string on screen After the for loop ends, display the entire string 2. Write a for loop with a range...
must use python Write a nested for loop that displays the following output using the same...
must use python Write a nested for loop that displays the following output using the same integer from part a:                                                     1                                                 1   2   1                                             1   2   4   2   1                                         1   2   4   8   4   2   1                                     1   2   4   8 16   8   4   2   1                                 1   2   4   8 16 32 16   8   4   2   1                             1   2   4   8 16 32 64 32 16   8   4   2   1                         1   2   4  ...
Create a python code that calculates fixed point iteration method using a for loop.
Create a python code that calculates fixed point iteration method using a for loop.
USE PYTHON Create a single list that contains the following collection of data in the order...
USE PYTHON Create a single list that contains the following collection of data in the order provided: [1121, "Jackie Grainger", 22.22, 1122, "Jignesh Thrakkar", 25.25, 1127, "Dion Green", 28.75, False, 24.32, 1132, "Jacob Gerber", "Sarah Sanderson", 23.45, 1137, True, "Brandon Heck", 1138, 25.84, True, 1152, "David Toma", 22.65, 23.75, 1157, "Charles King", False, "Jackie Grainger", 1121, 22.22, False, 22.65, 1152, "David Toma"] The data above represents employee information exported from an Excel spreadsheet. Whomever typed the data in originally didn't...
Python: High school assignment, please keep simple In python: Use the following initializer list to create...
Python: High school assignment, please keep simple In python: Use the following initializer list to create an array: twainQuotes = ["I have never let my schooling interfere with my education.", "Get your facts first, and then you can distort them as much as you please.", "If you tell the truth, you don't have to remember anything.", "The secret of getting ahead is getting started.", "Age is an issue of mind over matter. If you don't mind, it doesn't matter. "]...
1. Write a python program to create a list of integers using random function. Use map...
1. Write a python program to create a list of integers using random function. Use map function to process the list on the expression: 3x2+4x+5 and store the mapped elements in another list. Now use filter to do sum of all the elements in another list. 2. Write a function that takes n as input and creates a list of n lists such that ith list contains first 10 multiples of i. 3. Write a function that takes a number...
Write a python program to create a list of integers using random function. Use map function...
Write a python program to create a list of integers using random function. Use map function to process the list on the series: x + x2/2! + x3/3! + ….n and store the mapped elements in another list. Assume the value of n as 10
USING PYTHON Write a program to create a number list. It will call a function to...
USING PYTHON Write a program to create a number list. It will call a function to calculate the average values in the list. Define main ():                        Declare variables and initialize them                        Create a list containing numbers (int/float)                        Call get_avg function that will return the calculated average values in the list.                                       Use a for loop to loop through the values in the list and calculate avg                        End main()
Using python Create a function that inputs a list of numbers and outputs the median of...
Using python Create a function that inputs a list of numbers and outputs the median of the numbers. sort them and them show the output.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT