1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sveticcg [70]
4 years ago
12

Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom fu

nctions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning function defined to take a Fahrenheit temperature as a parameter. This function should calculate the equivalent Celsius temperature and return it. In the main function, your program should:
Computers and Technology
1 answer:
Klio2033 [76]4 years ago
4 0

A Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions.

Explanation:

  • Functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter.
  • It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places.
  • Custom function f_to_c should be a value-returning function defined to take a Fahrenheit temperature as a parameter.
  • This function should calculate the equivalent Celsius temperature and return it.

The code is given below :

def c_to_f(tempCelsius):

  tempFahrenheit = ((9/5)*tempCelsius) + 32;

  print("\n %.3f Celsius is %.3f Fahrenheit \n" %(tempCelsius, tempFahrenheit));

def f_to_c(tempFahrenheit):

  tempCelsius = (tempFahrenheit - 32) * (5/9);

  return tempCelsius;

(Import modules)

import temps;  

def main():

  temperature = float(input("\n Enter a temperature: "));

  scale = input("\n Was that input Fahrenheit or Celsius c/f? ");

  if scale.lower() == 'c':

      temps.c_to_f(temperature);

  else:

 tempCel = temps.f_to_c(temperature);

      print("\n %.1f Fahrenheit equals %.3f Celsius \n" %(temperature, tempCel));

main();

You might be interested in
Which is the base class in the following statement? class car : public vehicle
tatiyna

The base class in the following statements is the vehicle class.

<h3>What is a base class?</h3>

A base class is also known as a parent class.

A parent class is the existing class from which the other classes are determined and properties are inherited.

The class car is the child class. The child class inherit the properties of the parent class or the base class.

Therefore, the base class is the vehicle class.

learn more on class here; brainly.com/question/14293976

#SPJ11

8 0
2 years ago
How will you create a blog using Wordpress?​
levacccp [35]

Answer:

yes

Explanation:

8 0
3 years ago
Read 2 more answers
Coding question. Please help me?
Marizza181 [45]

Answer:

a  for a loop

Explanation:

7 0
3 years ago
Write a job back with my best Interest
Katena32 [7]

Answer:

be a doctor

Explanation:

u will help people and save them and get paid

6 0
3 years ago
Read 2 more answers
A _____________ delivers all the files that form web pages
Alexus [3.1K]

The database of the worldwide web delivers all the files that form web pages.

<h3>What is the worldwide web?</h3>

The World Wide Web (WWW), sometimes known as the Web, is the most widely used software platform on the planet  It is an online information space where documents and other web resources can be viewed using a web browser through the Internet.  

The Internet has had a huge impact on people's lives.  It is the major means of communication on the Internet for billions of people throughout the world.

Therefore database of the worldwide web delivers all the files that form web pages.

To know more about the worldwide web follow

brainly.com/question/14715750

#SPJ4

6 0
2 years ago
Other questions:
  • An engineer is assigned the task of reducing the air pollutants being released from a power plant that generates electricity by
    9·1 answer
  • Suppose a worker needs to process 100 items. the time to process each item is exponentially distributed with a mean of 2 minutes
    5·1 answer
  • Speed is how fast an object moves a certain distance within a length of time. How is speed calculated?
    14·2 answers
  • The R1 shell opens in a terminal window with black text and white background. What user is logged into
    8·1 answer
  • What is metrical task system algorithm?? and can we use that in online shopping project??
    11·1 answer
  • If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an app
    5·1 answer
  • What is the target audience of an ad?
    11·1 answer
  • Network administrators use _______ technology to get antivirus updates to be automatically downloaded on employees' workstations
    15·1 answer
  • Slide layouts can be changed by _________
    6·1 answer
  • If you answer these questions correctly I will mark you BRAINLIST.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!