Home » Python » Python programs

Python program to convert meters into yards

Meters to yards conversion: Here, we are going to learn how to convert meters into yards using python program?
Submitted by Anuj Singh, on July 11, 2019

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

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

Key: 1 meter = 1.094 yards

Example:

    Input:
    Meters: 245

    Output:
    Yards: 268.03000000000003

Python code to convert Meters to yards

# Python program to convert Centimeter to Inches 
# taking input
num = float(input("Enter the distance measured in centimeter : "))

# converting from cms to inches
""" 1 inch = 2.54 centimeters"""
inc = num/2.54 

# printing the result
print("Distance in inch : ", inc)

Output

First run:
Enter the distance measured in meters : 245
Distance in yards :  268.03000000000003 

Second run:
Enter the distance measured in meters : 54
Distance in yards :  59.07600000000001

Third run:
Enter the distance measured in meters : 100
Distance in yards :  109.4 





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL







Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.