Python Program to Convert cm to Feet and Inches

Python Program to Convert cm to Feet and Inches

Python program to convert a given height in centimeters to feet and inches; In this tutorial, you will learn how to convert height in cm to feet and inches.

Python Program to Convert cm to Feet and Inches

  • Python program to convert height centimeters to inches.
  • Python program to convert height centimeters to feet.

Python program to convert height centimeters to inches

See the following steps and write a python program to accept the height in cm and convert it into inches:

  • Take the input from user by using python input() function.
  • Convert the height in centimeters into inches.
  • Print the length in inches.
#take input from user
cm=int(input("Enter the height in centimeters:"))

#convert centimeter to inche
inches=0.394*cm

#print result
print("The length in inches",round(inches,2))

Output

Enter the height in centimeters: 167
The length in inches 65.8

Python program to convert height centimeters to feet

See the following steps and write a python program to accept the height in cm and convert it into feet:

  • Take the input from user by using python input() function.
  • Convert the height in centimeters into feet.
  • Print the length in feet.
#take input from user
cm=int(input("Enter the height in centimeters:"))

#convert centimeter to feet
feet=0.0328*cm

#print result
print("The length in feet",round(feet,2))

Output

Enter the height in centimeters: 167
The length in feet 5.48

Recommended Python Programs

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published.