Python Program to Convert Meters to Yards, Yards to Meters

Python program to convert meters to yard and yard to meters; Through this tutorial, i am going to show you how to convert meters to yard and yard to meter in python program.

In this tutorial, i will write a python program to convert meters to yards and yards to meters.

Python Program to Convert Meters to Yards, Yards to Meters

See the following python programs to convert meters to yards and yards to meters:

  • Python program to convert meters into yards.
  • Python program to convert yards into meters.
  • Python program to convert centimeter to meter.

Python program to convert meters into yards

  • Take the input from user by using python input() function.
  • Convert the meters into yards by using this formula num/2.54.
  • Print the result.
# 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

Enter the distance measured in centimeter :  100
Distance in inch :  39.37007874015748

Python program to convert yards into meters

  • Take the input from user by using python input() function.
  • Convert yards into meters by using this formula num/1.094.
  • Print the result.
# Python program to convert yards into meters
# take input from user
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

Enter the distance measured in yards :  15
Distance in meters :  13.711151736745885

Python program to convert centimeter to meter

  • Take the input from user by using python input() function.
  • Convert centimeter to meter by using this formula cm / 100.0.
  • Print the result.
# Python program to convert centimeter to meter
# take input from user
cm = float(input("Enter the centimeter : "))
  
# Converting centimeter  
meter = cm / 100.0; 
  
# Display result
print("Length in meter = " , meter , "m");

Output

Enter the centimeter :  100
Length in meter =  1.0 m

Recommended Python Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.