Skip to main content

Convert Centimeters to Inches Python Programming | Python Program Conver...

YouTube Video Tutorial How to write a Python program to convert centimetres to inches

Formula to convert centimetres to inches


 

Explanation of this Python Program

This Python program prompts the user to enter a height in inches, converts it to centimeters, and then prints the converted value. It uses the conversion factor of 2.54 to perform the conversion and rounds the result to two decimal places before displaying it to the user.

Here's an explanation of the provided Python program line by line:

python
inches = float(input('Enter the Height in inches to convert into centimeters:'))
  • This line prompts the user to enter a height in inches and assigns the entered value to the variable inches.
  • The input() function is used to receive input from the user, and float() is used to convert the input into a floating-point number.
python
centimeters = inches * 2.54
  • This line calculates the equivalent value in centimeters by multiplying the inches variable by the conversion factor 2.54.
  • The result is assigned to the variable centimeters.
python
centimeters = round(centimeters, 2)
  • This line rounds the value in centimeters to two decimal places using the round() function.
  • The rounded value is then assigned back to the centimeters variable.
python
print(inches, 'Inches =', centimeters, 'Centimeters')
  • This line displays the result of the conversion to the user.
  • The print() function is used to output a formatted string that includes the original inches value, the equal sign, and the converted centimeters value.


Comments

Popular posts from this blog

Definition and History of ECommerce

What do you mean by E-Commerce? Electronic Commerce (e-Commerce) is a general concept covering any form of business transaction or information exchange executed using information and communication technologies (ICTs). e-Commerce takes place between companies, between companies and their customers, or between companies and public administrations. Electronic Commerce includes electronic trading of goods, services and electronic material. BRIEF HISTORY OF E-COMMERCE + E-commerce started in early 1970’s with invention of electronic fund transfer(EFT). + Only used by large organizations, financial institutions and a few small business at that time. + After invention of EDI (Electronic Data Interchange) from financial institutions to manufacturers retailers, services and so on. + Many other e-commerce applications started from stock trading to travel reservation system. + With commercialization of internet in early 1990’s. The term electronic commerce was used. Interne...

Important objective type questions 1-50

FTP stand for     file transfer protocol. Lady ADA is the mother of computer.    VINT CERF     is the father of Internet. Nibble consists of   4   bits.   Google     and   Yahoo   are the two search engines. TCP/IP stands for Transmission control protocol/Internet protocol. One sector on Hard Disk holds   512    bytes.   Dos, window and UNIX are three operating systems. Demodulation converts Analog signal into Digital signal. ARPANET stands for advanced research project agency network. URL stands for uniform resource locator . Charles Babbage is the father of computer. Lady ADA is the first computer programmer. Nibble contains 04 numbers of bits. Name Two Mail service mail Yahoo.com. VOIP stands for Voice over internet protocol. One sector holds 512 numbers of bytes. N...

Services Of Internet

SERVICES PROVIDED BY INTERNET Important services provided by internet are as the following: 1. THE WORLD WIDE WEB This is also called web or www or 3w. The collection of all web pages in all web sites on Internet is called www. These web pages provide us information in the form of text, pictures, audio and video formats etc. 2. E-MAIL E-mail stands for electronic mail. It is the most popular, cheap, easy and fastest mailing service. We can send and receive messages on internet with in seconds or minutes. 3. EMAIL DISCUSSION GROUPS These are used to discuss different topics with other people by email. 4. NEWSGROUPS Newsgroups are discussion groups on internet. They are used for free exchange of information. A user sends a message to the news group site. Other users read this message from this site and reply. Newsgroups are provided by special computers called news servers. 5. ECOMMERCE It stands for Electronic Commerce. E-commerce means to carry out business dealings by internet...