Recall that we wrote a program to convert from Fahrenheit to Celsius. Let's say we want...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Recall that we wrote a program to convert from Fahrenheit to Celsius. Let's say we want to print out a table with the temperatures in Fahrenheit from 0 to 100 in steps of 10 along with their Celsius equivalents. First, we can write a function that converts from Fahrenheit to Celsius. The function has one parameter. The variable tempF represents the temperature in Fahrenheit. The function then uses that to compute the corresponding Celsius temperature. The last statement returns this result as its answer. Now we can write a program that uses this function, calling it with each Fahrenheit temperature from 0 to 100 in steps of 10. The formula for converting a temperature from Fahrenheit to Celsius : C = 5/9*(F-32) Hint; def f_to_c(tempF): #Convert fahrenheit temperature to celsius temperature tempC = return def main(): #Display "F print ( fahrenheit_temp = 0 while fahrenheit_temp C" #call the function f_to_c celsius_temp = # display fahrenheit temperature and celsius temperature. Format celsius temperature to 2 decimal places. print ( #Increment fahrenheit temperature by some value fahenheit_temp = #call the function main Output F 0 10 20 30 40 с -17.78 -12.22 -6.67 -1.11 4.44 10.00 15.56 21.11 26.67 32.22 37.78 Partial coding 50 60 70 80 90 100 def main(): print ("Fahrenheit", "\t", "Celsius") for x in range(11): celsius_temp = f_to_c(x*10) print (x*10,"\t\t", "{:.2f}".format(celsius_temp)) def f_to_c(tempF): tempC = (5/9) * (tempF - 32) return tempC main() Recall that we wrote a program to convert from Fahrenheit to Celsius. Let's say we want to print out a table with the temperatures in Fahrenheit from 0 to 100 in steps of 10 along with their Celsius equivalents. First, we can write a function that converts from Fahrenheit to Celsius. The function has one parameter. The variable tempF represents the temperature in Fahrenheit. The function then uses that to compute the corresponding Celsius temperature. The last statement returns this result as its answer. Now we can write a program that uses this function, calling it with each Fahrenheit temperature from 0 to 100 in steps of 10. The formula for converting a temperature from Fahrenheit to Celsius : C = 5/9*(F-32) Hint; def f_to_c(tempF): #Convert fahrenheit temperature to celsius temperature tempC = return def main(): #Display "F print ( fahrenheit_temp = 0 while fahrenheit_temp C" #call the function f_to_c celsius_temp = # display fahrenheit temperature and celsius temperature. Format celsius temperature to 2 decimal places. print ( #Increment fahrenheit temperature by some value fahenheit_temp = #call the function main Output F 0 10 20 30 40 с -17.78 -12.22 -6.67 -1.11 4.44 10.00 15.56 21.11 26.67 32.22 37.78 Partial coding 50 60 70 80 90 100 def main(): print ("Fahrenheit", "\t", "Celsius") for x in range(11): celsius_temp = f_to_c(x*10) print (x*10,"\t\t", "{:.2f}".format(celsius_temp)) def f_to_c(tempF): tempC = (5/9) * (tempF - 32) return tempC main()
Expert Answer:
Answer rating: 100% (QA)
The python program to convert fahrenheit temperatur... View the full answer
Related Book For
Posted Date:
Students also viewed these electrical engineering questions
-
I need help converting the absorbance rates to moles/ second using Beer's law. In question 2. Then need help in question 3 please. I gave the absorbance rates in the 2nd picture, the other charts per...
-
how convert a Raptor flowchart to a Python program Problem Convert the Raptor flowchart in the lab assignment 2 to Python. The file will should be lab6. Run time output Enter the gross income:...
-
I need someone to log into my Sam account and help me with my next two assignments using the Microsoft Access. You'll need a windows computer to complete this assignment.
-
I need one or more queries on the basis of database of netflix. I can upload the picture of database Create Index Modify Table Schema Delete Table Print CREATE TABLE Dates ( [PK] INTEGER PRIMARY KEY...
-
What are the principal differences among residential loans, nonresidential installment loans, noninstallment loans, and credit card or revolving loans?
-
Using dimensional equations, convert (a) 3 wk to milliseconds. (b) 38.1 ft/s to miles/h (c) 554 m 4 /(day kg) to cm 4 / (min g).
-
North Shore Architectural Stone, Inc., a company that installs limestone in residential and commercial buildings, agreed to supply and install limestone for a property owned by Joseph Vitacco. North...
-
Multiple Choice. Choose the best answer. 1. When equipment was purchased with General Fund resources, which of the following accounts would have been debited in the General Fund? a. Expenditures. b....
-
Activity 1 Response: Measure the temperature of the environment (ambient temperature), the human body (both forehead and under the tongue), and two other objects in the room. Record this information...
-
Amfac Company manufactures a single product. The company keeps careful records of manufacturing activities from which the following information has been extracted: The companys manufacturing overhead...
-
Pro-Mate, Inc. is a producer of athletic equipment. The company is considering the purchase of a machine to produce baseball bats. The machine will cost $60,000 and have a 10-year useful life. The...
-
Show that Y 1 = 1 and Y 2 = ?x aresolutions of Y*Y" + (Y') 2 = 0, but that their sum Y =Y 1 + Y 2 is not a solution.
-
Consider a course registration system for a college. Students are expected to register for the course of study of their choice. Additionally, an administrator at the college does occasionally add new...
-
create a method that will turn a fixed-size array Bag into a set. A Set is an abstract data type somewhat similar to a Bag, they can store a finite collection of objects without any particular order....
-
Based on the formula derived in the slides on corporate securities, what is the appropriate credit spread for a corporate bond with a 5% probability of default and an 80% expected recovery rate....
-
JAVA SAMPLE OUTPUT: Welcome to Weasleys' Wizard Wheezes! Can we help the next witch or wizard? (1 = yes, Here is our price list: Pygmy Puffs (each) Extendable Ears (each) Extendable Ears (bag of...
-
Prepare Income statement with Notes October 2021 1 Issued a check for P44,000 to Properties Management, Inc. for the October rent. 2 Signed a three-month radio advertising contract with Cable Station...
-
Show, if u(x, y) and v(x, y) are harmonic functions, that u + v must be a harmonic function but that uv need not be a harmonic function. Is e"e" a harmonic function?
-
When a user program makes a system call to read or write a disk file, it provides an indication of which file it wants, a pointer to the data buffer, and the count. Control is then transferred to the...
-
How is signal handling done in the model of Fig. 8-7?
-
A user at a terminal issues a command to an editor to delete the word on line 5 occupying character positions 7 through and including 12. Assuming the cursor is not on line 5 when the command is...
-
Martin Galloway, the sole proprietor of a consulting business, has gross receipts of $45,000 in 2017. His address is: 1223 Fairfield Street, Westfield, New Jersey and his SSN is 158-68-7799. Expenses...
-
Probest Corporation (a calendar-year corporation) purchased and placed the following assets in service during the year All assets are used 100 percent for business. $100,000 of the cost of the...
-
In May 2016, Jose purchased a used automobile for $12,000 and used it 75 percent for business. No Section 179 election was made for this asset. In 2017, Joses business use of the automobile decreased...
Study smarter with the SolutionInn App