Question

1. In Python, Write a function to convert inches into yards, feet and inches. The functions...

1.  In Python, Write a function to convert inches into yards, feet and inches.  The
    functions should take one parameter, 'inches', and print out the
    number of yards, feet, and inches equivalent to the value of the
    argument.

    Call the function after prompting the user to enter the number of
    inches.  Don't forget to convert the input to an 'int'.

2. In Python,Write a function to convert celsius to fahrenheit.  The function
    should return a value, which you should assign to a variable and then
    print that variable.

    Call the function after prompting the user to enter 3 values.

3.  In Python, Write a function to convert fahrenheit to celsius.  The function
    should return a value, which you should assign to a variable and then
    print that variable.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

def convert(inches):
yards = 0.0277778 * inches
feet = 0.0833333 * inches
print("Yards:",yards)
print("Feet and Inches:",feet)

inches = int(input("Enter the number of inches: "))
convert(inches)

Output:

$python3 main.py
Enter the number of inches: 5
Yards: 0.13888899999999998
Feet and Inches: 0.4166665

def CTOF(temp):
return temp*(9/5.0) + 32

t1 = CTOF(212)
t2 = CTOF(111)
t3 = CTOF(11)
print(t1)
print(t2)
print(t3)

def FTOC(temp):
return (temp-32) * (5/9.0)
  
t1 = FTOC(212)
t2 = FTOC(111)
t3 = FTOC(11)
print(t1)
print(t2)
print(t3)

Output:

Add a comment
Know the answer?
Add Answer to:
1. In Python, Write a function to convert inches into yards, feet and inches. The functions...
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...

  • C++ Write a function that receives a length in yards, feet, and inches and returns the correspond...

    C++ Write a function that receives a length in yards, feet, and inches and returns the corresponding measurement in centimeters. (1 in = 2.54001 cm). The function is expected to receive the reference parameters yards, feet and inch. Ask users to enter the number of values for yards, feet and inches, and the function will convert into centimeters once the function is called. Use cout in the main() to display the result.

  • In python using a def main() function, Write a function that will print a hello message,...

    In python using a def main() function, Write a function that will print a hello message, then ask a user to enter a number of inches (should be an integer), and then convert the value from inches to feet. This program should not accept a negative number of inches as an input. The result should be rounded to 2 decimal places(using the round function) and printed out on the screen in a format similar to the example run. Use a...

  • Python Programming 4th Edition: Write a program that asks the user for the number of feet....

    Python Programming 4th Edition: Write a program that asks the user for the number of feet. The program converts those feet to inches by using the formula ’12 * feet’. Hint: Define main () program Get the number of feet from the user Define variables Call a function feet_to_inches(feet) The function receives the number of feet and returns the number of inches in that many feet. The output should look like as follows: Enter the number of feet: If the...

  • python - Write a program that converts square feet to square yards. Prompt the user to...

    python - Write a program that converts square feet to square yards. Prompt the user to enter a value in square feet and then print the converted output along with a message similar to "1 sq. ft. is .11111 sq. yards."

  • Write a program on Python Shell (3.8.1) that Makes the conversion of inches to yards, feet...

    Write a program on Python Shell (3.8.1) that Makes the conversion of inches to yards, feet and inches.

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

  • Please write individual functions solving each of the following problems: Print your name Print numbers 1...

    Please write individual functions solving each of the following problems: Print your name Print numbers 1 → 10 Print numbers N → M, where N and M are parameters to the function .Calculate and return a base B to an exponent E. B and E should be parameters to the function Convert Celsius to Fahrenheit Convert Fahrenheit to Celsius Take a numeric score as a parameter and return the associated letter grade Note, the functions that perform calculations should NOT...

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