Ask Question
8 January, 21:35

One foot equals 12 inches. Write a function named feet_to_inches that accepts a number of feet as an argument and returns the number of inches in that many feet. Use the function in a program that prompts the user to enter a number of feet and then displays the number of inches in that many feet.

+3
Answers (1)
  1. 9 January, 00:14
    0
    def feet_to_inches (feet):

    inches = feet * 12

    print (inches, "inches")

    feet_to_inches (10)

    Explanation:

    The code is written in python. The unit for conversion base on your question is that 1 ft = 12 inches. Therefore,

    def feet_to_inches (feet):

    This code we define a function and pass the argument as feet which is the length in ft that is required when we call the function.

    inches = feet * 12

    Here the length in ft is been converted to inches by multiplying by 12.

    print (inches, "inches")

    Here we print the value in inches.

    feet_to_inches (10)

    Here we call the function and pass the argument in feet to be converted
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “One foot equals 12 inches. Write a function named feet_to_inches that accepts a number of feet as an argument and returns the number of ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers