In: Computer Science
Write a function called main which gets a single number, furlongs, from the user and converts that to meters and prints out the converted result. The math you need to know is that there are 201.16800 meters in a furlong.
your results should yield something like these test cases.
>>> main()
How many furlongs? 10
your 10 furlongs are 2011.68 Meters
>>> main()
How many furlongs? 24
your 24 furlongs are 4828.032 Meters
Here is the completed code for this problem. Assuming the language is Python. Please don’t forget to mention the language while you post a question in future. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. If not, PLEASE let me know before you rate, I’ll help you fix whatever issues. Thanks
Note: Please maintain proper code spacing (indentation), just copy the code part and paste it in your compiler/IDE directly, no modifications required.
#code
def main():
METERS_IN_FURLONG = 201.16800 # defining number of meters in a furlong
furlongs = int(input("How many furlongs? ")) # asking, reading furlongs as an integer
meters = furlongs * METERS_IN_FURLONG # converting furlongs into meters
print("Your", furlongs, "furlongs are", meters, "Meters") # displaying result
# calling main() method
main()
#output
How many furlongs? 24
Your 24 furlongs are 4828.032 Meters