Python program to convert yards into meters

Yards to meters conversion: Here, we are going to learn how to convert yards into meters using python program?
By Anuj Singh Last updated : January 04, 2024

There are many problems where we have to calculate the distance in meters at the end but initially, the measurements are given in yards. So for such type of problems, the solution is converting the initial parameters into meters and then performing operations on it and another option is to perform operations in yards and then convert the final answer from yards to meters.

Problem statement

So, here in this article, we are going to write a code for converting the yards into meters.

Key: 1 meter = 1.094 yards

Example

Consider the below example with sample input and output:

Input:
Yards: 54

Output:
Meters: 49.36014625228519

Python program to convert yards into meters

# Python program to convert yards into meters
# input
num = float(input("Enter the distance measured in yards : "))

# converting from yards into meters
""" 1 meter = 1.094 yards"""
met = num/1.094 

# printing the result
print("Distance in meters : ", met)

Output

First run:
Enter the distance measured in yards : 54
Distance in meters :  49.36014625228519

Second run:
Enter the distance measured in yards : 1.094
Distance in meters :  1.0

Third run:
Enter the distance measured in yards : 245
Distance in meters :  223.9488117001828

To understand the above program, you should have the basic knowledge of the following Python topics:

Python Basic Programs »

Related Programs

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.