A cubit is an ancient unit of length, roughly the distance between one’s fingers and elbow. The definition of one cubit is 18 inches. Write a program consisting of one script and one function. The script does the following: ▪ prompts the user for the number of cubits ▪ calls a function cubit2inch to convert this number to inches ▪ prints the result

Respuesta :

Answer:

  1. def cubit2inch(c):
  2.    inches = c * 18
  3.    print(inches)
  4. cubit = int(input("Enter number of cubits: "))
  5. cubit2inch(cubit)

Explanation:

The solution code is written in Python 3.

Firstly, write a function cubit2inch that takes one input parameter, c. In the function, apply the formula to convert the cubit to inches and print it (Line 2 - 3).

In the main program, we prompt user to input number of cubits and convert it to numerical and assign it to cubit variable (Line 5). Call the function to print the converted inches (Line 6).