Question

# convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def...

# convert.py
#     A program to convert Celsius temps to Fahrenheit
# by: Susan Computewell
 
def main():
    celsius = eval(input("What is the Celsius temperature? "))
    fahrenheit = 9/5 * celsius + 32
    print("The temperature is", fahrenheit, "degrees Fahrenheit.")
 
main()
  • PORTION ONE: Based the convert.py, so it can convert temperatures from Fahrenheit to Celsius, instead of original Celsius to Fahrenheit. Make sure to change the message to reflect the change of introduction and final result.
  • Name it as: convert_v2.py.
  • Run it to see what the result is.
  • .
  • PORTION TWO: Based the convert.py, so it can convert distances measured in kilometers to miles. (1 km = 0.62 mile). Make sure the message is appropriate.
  • Name it as: convert_v3.py.
  • Run it to see what the result is.
  • .
  • PORTION THREE: Based the convert.py, so it can convert height measured in feet and inch to inches only. (e.g. 5 feet 2 inch will be ??? inches). Make sure the message is appropriate. The testing input should BOTH feet and inch as height.
  • Name it as: convert_v4.py.
  • Run it to see what the result is.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

# PORTION ONE: Based the convert.py, so it can convert temperatures from Fahrenheit to Celsius, instead of original Celsius to Fahrenheit. Make sure to change the message to reflect the change of introduction and final result.

# Name it as: convert_v2.py.

# Run it to see what the result is.

def main():

fahrenheit = eval(input("What is the Fahrenheit? "))

celsius = (fahrenheit - 32) / 1.8

print("The celsius is", celsius)

main()

Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
What is the Fahrenheit? 99.5
The celsius is 37.5

# PORTION TWO: Based the convert.py, so it can convert distances measured in kilometers to miles. (1 km = 0.62 mile). Make sure the message is appropriate.

# Name it as: convert_v3.py.

# Run it to see what the result is.

def main():

km = eval(input("How Many KMs? "))

mile = km * 0.62

print("In miles : ", mile)

main()

Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
How Many KMs? 10
In miles : 6.2

# PORTION THREE: Based the convert.py, so it can convert height measured in feet and inch to inches only. (e.g. 5 feet 2 inch will be ??? inches). Make sure the message is appropriate. The testing input should BOTH feet and inch as height.

# Name it as: convert_v4.py.

# Run it to see what the result is.

def main():

feet = eval(input("How Many feet? "))

inch = eval(input("How Many inches? "))

inches = (feet * 12) + (inch * 0.0833333333)

print(feet, " feet ", inch, "inches will be ", inches, " inches.")

main()


Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
How Many feet? 5
How Many inches? 2
5 feet 2 inches will be 60.1666666666 inches.

Add a comment
Know the answer?
Add Answer to:
# convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice...

    FOR PYTHON Write 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. Both of these functions should be defined in a custom module named temps. Custom functionc_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...

  • Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The...

    Write 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. 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...

  • Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The...

    Write 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. 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...

  • General overview This program will convert a set of temperatures from Fahrenheit to Celsius and Kelvin....

    General overview This program will convert a set of temperatures from Fahrenheit to Celsius and Kelvin. Your program will be reading in three double values. The first values are starting and ending temperatures. The third value is the increment value. There is no prompt for the input. There is an error message that can be displayed. This is discussed later. You need to display output for all of the values between the starting and ending values. First two values are...

  • Write a single C++ program that performs the following conversion (The modulus divide will help you...

    Write a single C++ program that performs the following conversion (The modulus divide will help you get the remainder as shown in class) 39 / 12 = 3 and 39 % 12 = 3, so 3 feet 3 inch(es) Height conversion 1 meter = 39 inches 12 inches = 1 foot Ask/Prompt the user to enter in the height in meters, convert and output the result in feet and inches Example 1 meters as input should produce 3 feet (foot)...

  • C# I am having trouble this program. So far my temperature converter program is converting temps...

    C# I am having trouble this program. So far my temperature converter program is converting temps from C to F. However, whenever I try to convert F to C, it's keep crashing and displaying an error message, which I can not figure it out and do not know how to fix it. Attached are two screenshots are of message. Do you know what is causing the issue? I would much appreciate your assistance. namespace Temp Conv { public partial class...

  • Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin...

    Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin Newton Your program should take a character which represents the temperature to convert from and a value to be converted to using the following specification: C - Celsius K - Kelvin N - Newton In addition your program should take in the following character to exit the program: X - eXit the program The numeric input for your program should be of type double....

  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • Write a program in C that will convert all 12 months' average temperature from Celsius to...

    Write a program in C that will convert all 12 months' average temperature from Celsius to Fahrenheit. You need to create an array named aye jump and prompt the user to input average temperature in Celsius for all 12 months. After that, you need to develop a user temperatures from Celsius to Fahrenheit and pass the array as reference and convert all temperatures from Celsius to Fahrenheit. Next, compute the average temperature of the year and assign it to a...

  • Exercise 5.4 The following program is supposed to convert a temperature in degree Fahrenheit to degree...

    Exercise 5.4 The following program is supposed to convert a temperature in degree Fahrenheit to degree Celsius, but it will not produce the correct result. Use type casting to fix the problem and run the program for the test values. Call your new program ex54.cpp. Test cases: 32 F is 0 C 212 F is 100 C PROGRAM: #include using namespace std; int main( ) {       int t_in_fah, t_in_cel;  //Notice that we declared these two as integers, not the best...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT