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

Let’s use the following algorithm to write a python program to convert the cm(centimeter) to inches, feet:

  • 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

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including 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. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *